@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blockLoader.d.ts","sourceRoot":"","sources":["../../src/blockLoader/blockLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"blockLoader.d.ts","sourceRoot":"","sources":["../../src/blockLoader/blockLoader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEjE,KAAK,cAAc,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE;QAAE,MAAM,EAAE,cAAc,EAAE,CAAA;KAAE,CAAC;CACzC,CAAC;AAEF,UAAU,SAAS;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,WAAW,EAAE,cAAc,EAAE,CAAC;CACjC;AA+CD,MAAM,MAAM,WAAW,CAAC,SAAS,GAAG,GAAG,IAAI,CAAC,OAAO,EAAE,kBAAkB,CAAC,SAAS,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;AAG1G,MAAM,MAAM,kBAAkB,CAAC,SAAS,GAAG,GAAG,IAAI;IAAE,SAAS,EAAE,SAAS,CAAA;CAAE,GAAG,uBAAuB,CAAC;AAErG,MAAM,WAAW,uBAAuB;IACpC,YAAY,EAAE,YAAY,CAAC;IAC3B,KAAK,EAAE,OAAO,KAAK,CAAC;CACvB;AAED,wBAAsB,wBAAwB,CAAC,EAC3C,SAAS,EACT,SAAS,EACT,UAAU,EACV,OAAO,EACP,GAAG,YAAY,EAClB,EAAE;IACC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;CACxC,GAAG,uBAAuB,gBA6D1B"}
|
|
@@ -1,55 +1 @@
|
|
|
1
|
-
async function
|
|
2
|
-
blockType,
|
|
3
|
-
blockData,
|
|
4
|
-
blocksMeta,
|
|
5
|
-
loaders,
|
|
6
|
-
...dependencies
|
|
7
|
-
}) {
|
|
8
|
-
function iterateField(block, passedBlockData) {
|
|
9
|
-
const blockData2 = { ...passedBlockData };
|
|
10
|
-
for (const field of block.fields) {
|
|
11
|
-
if (!blockData2[field.name]) {
|
|
12
|
-
continue;
|
|
13
|
-
} else if (field.kind == "NestedObjectList") {
|
|
14
|
-
blockData2[field.name] = blockData2[field.name].map((i) => {
|
|
15
|
-
return iterateField(field.object, i);
|
|
16
|
-
});
|
|
17
|
-
} else if (field.kind == "NestedObject") {
|
|
18
|
-
blockData2[field.name] = iterateField(field.object, blockData2[field.name]);
|
|
19
|
-
} else if (field.kind == "OneOfBlocks") {
|
|
20
|
-
const oneOfBlockType = field.blocks[blockData2.type];
|
|
21
|
-
if (!oneOfBlockType) throw new Error("invalid blockType");
|
|
22
|
-
blockData2[field.name] = iterateBlock({
|
|
23
|
-
blockType: oneOfBlockType,
|
|
24
|
-
blockData: blockData2[field.name]
|
|
25
|
-
});
|
|
26
|
-
} else if (field.kind == "Block") {
|
|
27
|
-
blockData2[field.name] = iterateBlock({
|
|
28
|
-
blockType: field.block,
|
|
29
|
-
blockData: blockData2[field.name]
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return blockData2;
|
|
34
|
-
}
|
|
35
|
-
const loadedBlockData = [];
|
|
36
|
-
function iterateBlock({ blockType: blockType2, blockData: blockData2 }) {
|
|
37
|
-
const block = blocksMeta.find((block2) => block2.name === blockType2);
|
|
38
|
-
if (!block) throw new Error("invalid blockType");
|
|
39
|
-
const newBlockData = iterateField(block, blockData2);
|
|
40
|
-
if (loaders[blockType2]) {
|
|
41
|
-
newBlockData.loaded = loaders[blockType2]({ blockData: blockData2, ...dependencies });
|
|
42
|
-
loadedBlockData.push(newBlockData);
|
|
43
|
-
}
|
|
44
|
-
return newBlockData;
|
|
45
|
-
}
|
|
46
|
-
const ret = iterateBlock({ blockType, blockData });
|
|
47
|
-
await Promise.all(loadedBlockData.map((blockData2) => blockData2.loaded));
|
|
48
|
-
for (const blockData2 of loadedBlockData) {
|
|
49
|
-
blockData2.loaded = await blockData2.loaded;
|
|
50
|
-
}
|
|
51
|
-
return ret;
|
|
52
|
-
}
|
|
53
|
-
export {
|
|
54
|
-
recursivelyLoadBlockData
|
|
55
|
-
};
|
|
1
|
+
async function e({blockType:e,blockData:o,blocksMeta:a,loaders:n,...c}){function t(e,o){const a={...o};for(const n of e.fields)if(a[n.name])if("NestedObjectList"==n.kind)a[n.name]=a[n.name].map(e=>t(n.object,e));else if("NestedObject"==n.kind)a[n.name]=t(n.object,a[n.name]);else if("OneOfBlocks"==n.kind){const e=n.blocks[a.type];if(!e)throw new Error("invalid blockType");a[n.name]=i({blockType:e,blockData:a[n.name]})}else"Block"==n.kind&&(a[n.name]=i({blockType:n.block,blockData:a[n.name]}));return a}const l=[];function i({blockType:e,blockData:o}){const i=a.find(o=>o.name===e);if(!i)throw new Error("invalid blockType");const k=t(i,o);return n[e]&&(k.loaded=n[e]({blockData:o,...c}),l.push(k)),k}const k=i({blockType:e,blockData:o});await Promise.all(l.map(e=>e.loaded));for(const s of l)s.loaded=await s.loaded;return k}export{e as recursivelyLoadBlockData};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DamFileDownloadLinkBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/DamFileDownloadLinkBlock.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,oBAAoB,EAAgB,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAEnF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"DamFileDownloadLinkBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/DamFileDownloadLinkBlock.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,oBAAoB,EAAgB,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAEnF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAExE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,UAAU,KAAM,SAAQ,aAAa,CAAC,4BAA4B,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACtH,QAAQ,EAAE,YAAY,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,wBAAwB,2GA4BpC,CAAC"}
|
|
@@ -1,28 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
import { cloneElement } from "react";
|
|
4
|
-
import { withPreview } from "../iframebridge/withPreview.js";
|
|
5
|
-
const DamFileDownloadLinkBlock = withPreview(
|
|
6
|
-
({ data: { file, openFileType }, children, legacyBehavior, ...anchorProps }) => {
|
|
7
|
-
if (!file) {
|
|
8
|
-
if (legacyBehavior) {
|
|
9
|
-
return children;
|
|
10
|
-
}
|
|
11
|
-
return /* @__PURE__ */ jsx("span", { className: anchorProps.className, children });
|
|
12
|
-
}
|
|
13
|
-
const href = file.fileUrl;
|
|
14
|
-
const target = openFileType === "NewTab" ? "_blank" : anchorProps.target;
|
|
15
|
-
if (legacyBehavior) {
|
|
16
|
-
return cloneElement(children, {
|
|
17
|
-
...anchorProps,
|
|
18
|
-
href,
|
|
19
|
-
target
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
return /* @__PURE__ */ jsx("a", { ...anchorProps, href, target, children });
|
|
23
|
-
},
|
|
24
|
-
{ label: "DamFileDownloadLink" }
|
|
25
|
-
);
|
|
26
|
-
export {
|
|
27
|
-
DamFileDownloadLinkBlock
|
|
28
|
-
};
|
|
2
|
+
import{jsx as e}from"react/jsx-runtime";import{cloneElement as r}from"react";import{withPreview as a}from"../iframebridge/withPreview.js";const t=a(({data:{file:a,openFileType:t},children:i,legacyBehavior:l,...n})=>{if(!a)return l?i:/* @__PURE__ */e("span",{className:n.className,children:i});const o=a.fileUrl,m="NewTab"===t?"_blank":n.target;return l?r(i,{...n,href:o,target:m}):/* @__PURE__ */e("a",{...n,href:o,target:m,children:i})},{label:"DamFileDownloadLink"});export{t as DamFileDownloadLinkBlock};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DamVideoBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/DamVideoBlock.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAyB,MAAM,OAAO,CAAC;AAErG,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"DamVideoBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/DamVideoBlock.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAyB,MAAM,OAAO,CAAC;AAErG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAI7D,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEvF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,UAAU,kBAAmB,SAAQ,aAAa,CAAC,iBAAiB,CAAC;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,YAAY,CAAC;IACpE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,eAAe,CAAC,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;CACzD;AAED,eAAO,MAAM,aAAa,wHAkGzB,CAAC"}
|
|
@@ -1,100 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import styles from "./DamVideoBlock.module.scss.js";
|
|
8
|
-
import { PlayPauseButton } from "./helpers/PlayPauseButton.js";
|
|
9
|
-
import { useIsElementInViewport } from "./helpers/useIsElementInViewport.js";
|
|
10
|
-
const DamVideoBlock = withPreview(
|
|
11
|
-
({
|
|
12
|
-
data: { damFile, autoplay, loop, showControls, previewImage },
|
|
13
|
-
aspectRatio = "16x9",
|
|
14
|
-
previewImageSizes,
|
|
15
|
-
renderPreviewImage,
|
|
16
|
-
fill,
|
|
17
|
-
previewImageIcon,
|
|
18
|
-
playButtonAriaLabel,
|
|
19
|
-
pauseButtonAriaLabel,
|
|
20
|
-
playPauseButton: PlayPauseButtonComponent
|
|
21
|
-
}) => {
|
|
22
|
-
var _a;
|
|
23
|
-
if (damFile === void 0) {
|
|
24
|
-
return /* @__PURE__ */ jsx(PreviewSkeleton, { type: "media", hasContent: false, aspectRatio });
|
|
25
|
-
}
|
|
26
|
-
const [showPreviewImage, setShowPreviewImage] = useState(true);
|
|
27
|
-
const [isPlaying, setIsPlaying] = useState(autoplay ?? false);
|
|
28
|
-
const [isHandledManually, setIsHandledManually] = useState(false);
|
|
29
|
-
const hasPreviewImage = Boolean(previewImage && previewImage.damFile);
|
|
30
|
-
const [videoElement, setVideoElement] = useState(null);
|
|
31
|
-
const videoRef = setVideoElement;
|
|
32
|
-
const handleInView = useCallback(
|
|
33
|
-
(inView) => {
|
|
34
|
-
if (!isHandledManually && videoElement) {
|
|
35
|
-
if (inView && autoplay) {
|
|
36
|
-
videoElement.play();
|
|
37
|
-
setIsPlaying(true);
|
|
38
|
-
} else {
|
|
39
|
-
videoElement.pause();
|
|
40
|
-
setIsPlaying(false);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
[autoplay, isHandledManually, videoElement]
|
|
45
|
-
);
|
|
46
|
-
useIsElementInViewport({ current: videoElement }, handleInView);
|
|
47
|
-
const handlePlayPauseClick = () => {
|
|
48
|
-
if (isPlaying) {
|
|
49
|
-
setIsPlaying(false);
|
|
50
|
-
setIsHandledManually(true);
|
|
51
|
-
videoElement == null ? void 0 : videoElement.pause();
|
|
52
|
-
} else {
|
|
53
|
-
setIsPlaying(true);
|
|
54
|
-
videoElement == null ? void 0 : videoElement.play();
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
return /* @__PURE__ */ jsx(Fragment, { children: hasPreviewImage && showPreviewImage ? renderPreviewImage({
|
|
58
|
-
onPlay: () => setShowPreviewImage(false),
|
|
59
|
-
image: previewImage,
|
|
60
|
-
aspectRatio,
|
|
61
|
-
sizes: previewImageSizes,
|
|
62
|
-
fill,
|
|
63
|
-
icon: previewImageIcon,
|
|
64
|
-
playButtonAriaLabel
|
|
65
|
-
}) : /* @__PURE__ */ jsxs("div", { className: styles.root, children: [
|
|
66
|
-
/* @__PURE__ */ jsxs(
|
|
67
|
-
"video",
|
|
68
|
-
{
|
|
69
|
-
autoPlay: autoplay || hasPreviewImage && !showPreviewImage,
|
|
70
|
-
controls: showControls,
|
|
71
|
-
loop,
|
|
72
|
-
playsInline: true,
|
|
73
|
-
muted: autoplay,
|
|
74
|
-
ref: videoRef,
|
|
75
|
-
className: clsx(styles.video, fill && styles.fill),
|
|
76
|
-
style: !fill ? { "--aspect-ratio": aspectRatio.replace("x", " / ") } : void 0,
|
|
77
|
-
children: [
|
|
78
|
-
(_a = damFile.captions) == null ? void 0 : _a.map((caption) => {
|
|
79
|
-
return /* @__PURE__ */ jsx("track", { src: caption.fileUrl, kind: "captions", srcLang: caption.language }, caption.id);
|
|
80
|
-
}),
|
|
81
|
-
/* @__PURE__ */ jsx("source", { src: damFile.fileUrl, type: damFile.mimetype })
|
|
82
|
-
]
|
|
83
|
-
}
|
|
84
|
-
),
|
|
85
|
-
!showControls && (PlayPauseButtonComponent ? /* @__PURE__ */ jsx(PlayPauseButtonComponent, { isPlaying, onClick: handlePlayPauseClick }) : /* @__PURE__ */ jsx(
|
|
86
|
-
PlayPauseButton,
|
|
87
|
-
{
|
|
88
|
-
isPlaying,
|
|
89
|
-
onClick: handlePlayPauseClick,
|
|
90
|
-
ariaLabelPlay: playButtonAriaLabel,
|
|
91
|
-
ariaLabelPause: pauseButtonAriaLabel
|
|
92
|
-
}
|
|
93
|
-
))
|
|
94
|
-
] }) });
|
|
95
|
-
},
|
|
96
|
-
{ label: "Video" }
|
|
97
|
-
);
|
|
98
|
-
export {
|
|
99
|
-
DamVideoBlock
|
|
100
|
-
};
|
|
2
|
+
import{jsx as e,Fragment as a,jsxs as i}from"react/jsx-runtime";import o from"clsx";import{useState as r,useCallback as l}from"react";import{withPreview as t}from"../iframebridge/withPreview.js";import{PreviewSkeleton as s}from"../previewskeleton/PreviewSkeleton.js";import n from"./DamVideoBlock.module.scss.js";import{PlayPauseButton as p}from"./helpers/PlayPauseButton.js";import{useIsElementInViewport as m}from"./helpers/useIsElementInViewport.js";const c=t(({data:{damFile:t,autoplay:c,loop:u,showControls:d,previewImage:y},aspectRatio:f="16x9",previewImageSizes:v,renderPreviewImage:P,fill:g,previewImageIcon:w,playButtonAriaLabel:h,pauseButtonAriaLabel:I,playPauseButton:b})=>{if(void 0===t)/* @__PURE__ */
|
|
3
|
+
return e(s,{type:"media",hasContent:!1,aspectRatio:f});const[k,B]=r(!0),[j,L]=r(c??!1),[x,C]=r(!1),A=Boolean(y&&y.damFile),[R,V]=r(null),z=V,F=l(e=>{!x&&R&&(e&&c?(R.play(),L(!0)):(R.pause(),L(!1)))},[c,x,R]);m({current:R},F);const N=()=>{j?(L(!1),C(!0),R?.pause()):(L(!0),R?.play())};/* @__PURE__ */
|
|
4
|
+
return e(a,{children:A&&k?P({onPlay:()=>B(!1),image:y,aspectRatio:f,sizes:v,fill:g,icon:w,playButtonAriaLabel:h}):/* @__PURE__ */i("div",{className:n.root,children:[
|
|
5
|
+
/* @__PURE__ */i("video",{autoPlay:c||A&&!k,controls:d,loop:u,playsInline:!0,muted:c,ref:z,className:o(n.video,g&&n.fill),style:g?void 0:{"--aspect-ratio":f.replace("x"," / ")},children:[t.captions?.map(a=>/* @__PURE__ */e("track",{src:a.fileUrl,kind:"captions",srcLang:a.language},a.id)),
|
|
6
|
+
/* @__PURE__ */e("source",{src:t.fileUrl,type:t.mimetype})]}),!d&&(b?/* @__PURE__ */e(b,{isPlaying:j,onClick:N}):/* @__PURE__ */e(p,{isPlaying:j,onClick:N,ariaLabelPlay:h,ariaLabelPause:I}))]})})},{label:"Video"});export{c as DamVideoBlock};
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
const video = "_video_1jlho_6";
|
|
3
|
-
const fill = "_fill_1jlho_12";
|
|
4
|
-
const styles = {
|
|
5
|
-
root,
|
|
6
|
-
video,
|
|
7
|
-
fill
|
|
8
|
-
};
|
|
9
|
-
export {
|
|
10
|
-
styles as default,
|
|
11
|
-
fill,
|
|
12
|
-
root,
|
|
13
|
-
video
|
|
14
|
-
};
|
|
1
|
+
const o="_root_1jlho_1",_="_video_1jlho_6",l="_fill_1jlho_12",t={root:o,video:_,fill:l};export{t as default,l as fill,o as root,_ as video};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailLinkBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/EmailLinkBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAwC,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAE3G,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"EmailLinkBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/EmailLinkBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAwC,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAE3G,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,UAAU,mBAAoB,SAAQ,aAAa,CAAC,kBAAkB,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC1H,QAAQ,EAAE,YAAY,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,cAAc,GAAI,+DAA+D,mBAAmB,4CAuBhH,CAAC"}
|
|
@@ -1,21 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { cloneElement } from "react";
|
|
3
|
-
const EmailLinkBlock = ({ data: { email }, children, legacyBehavior, ...anchorProps }) => {
|
|
4
|
-
if (!email) {
|
|
5
|
-
if (legacyBehavior) {
|
|
6
|
-
return children;
|
|
7
|
-
}
|
|
8
|
-
return /* @__PURE__ */ jsx("span", { className: anchorProps.className, children });
|
|
9
|
-
}
|
|
10
|
-
const href = `mailto:${email}`;
|
|
11
|
-
if (legacyBehavior) {
|
|
12
|
-
return cloneElement(children, {
|
|
13
|
-
...anchorProps,
|
|
14
|
-
href
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
return /* @__PURE__ */ jsx("a", { ...anchorProps, href, children });
|
|
18
|
-
};
|
|
19
|
-
export {
|
|
20
|
-
EmailLinkBlock
|
|
21
|
-
};
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{cloneElement as e}from"react";const a=({data:{email:a},children:t,legacyBehavior:c,...i})=>{if(!a)return c?t:/* @__PURE__ */r("span",{className:i.className,children:t});const m=`mailto:${a}`;return c?e(t,{...i,href:m}):/* @__PURE__ */r("a",{...i,href:m,children:t})};export{a as EmailLinkBlock};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExternalLinkBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/ExternalLinkBlock.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,oBAAoB,EAAgE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAEnI,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ExternalLinkBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/ExternalLinkBlock.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,oBAAoB,EAAgE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAEnI,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAIjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,UAAU,sBAAuB,SAAQ,aAAa,CAAC,qBAAqB,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAChI,QAAQ,EAAE,YAAY,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,wBAAgB,iBAAiB,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,WAAW,EAAE,EAAE,sBAAsB,2CAsD3I"}
|
|
@@ -1,48 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
import { cloneElement } from "react";
|
|
4
|
-
import { usePreview } from "../preview/usePreview.js";
|
|
5
|
-
import { sendSitePreviewIFrameMessage } from "../sitePreview/iframebridge/sendSitePreviewIFrameMessage.js";
|
|
6
|
-
import { SitePreviewIFrameMessageType } from "../sitePreview/iframebridge/SitePreviewIFrameMessage.js";
|
|
7
|
-
function ExternalLinkBlock({ data: { targetUrl, openInNewWindow }, children, legacyBehavior, ...anchorProps }) {
|
|
8
|
-
const preview = usePreview();
|
|
9
|
-
if (preview.previewType === "SitePreview" || preview.previewType === "BlockPreview") {
|
|
10
|
-
const onClick = (event) => {
|
|
11
|
-
event.preventDefault();
|
|
12
|
-
if (preview.previewType === "SitePreview") {
|
|
13
|
-
sendSitePreviewIFrameMessage({
|
|
14
|
-
cometType: SitePreviewIFrameMessageType.OpenLink,
|
|
15
|
-
data: { link: { openInNewWindow, targetUrl } }
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
if (legacyBehavior) {
|
|
20
|
-
return cloneElement(children, {
|
|
21
|
-
...anchorProps,
|
|
22
|
-
href: "#",
|
|
23
|
-
onClick
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
return /* @__PURE__ */ jsx("a", { ...anchorProps, href: "#", onClick, children });
|
|
27
|
-
} else {
|
|
28
|
-
if (!targetUrl) {
|
|
29
|
-
if (legacyBehavior) {
|
|
30
|
-
return children;
|
|
31
|
-
}
|
|
32
|
-
return /* @__PURE__ */ jsx("span", { className: anchorProps.className, children });
|
|
33
|
-
}
|
|
34
|
-
const href = targetUrl;
|
|
35
|
-
const target = openInNewWindow ? "_blank" : anchorProps.target;
|
|
36
|
-
if (legacyBehavior) {
|
|
37
|
-
return cloneElement(children, {
|
|
38
|
-
...anchorProps,
|
|
39
|
-
href,
|
|
40
|
-
target
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
return /* @__PURE__ */ jsx("a", { ...anchorProps, href, target, children });
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
export {
|
|
47
|
-
ExternalLinkBlock
|
|
48
|
-
};
|
|
2
|
+
import{jsx as e}from"react/jsx-runtime";import{cloneElement as r}from"react";import{usePreview as i}from"../preview/usePreview.js";import{sendSitePreviewIFrameMessage as t}from"../sitePreview/iframebridge/sendSitePreviewIFrameMessage.js";import{SitePreviewIFrameMessageType as a}from"../sitePreview/iframebridge/SitePreviewIFrameMessage.js";function n({data:{targetUrl:n,openInNewWindow:o},children:s,legacyBehavior:p,...m}){const c=i();if("SitePreview"===c.previewType||"BlockPreview"===c.previewType){const i=e=>{e.preventDefault(),"SitePreview"===c.previewType&&t({cometType:a.OpenLink,data:{link:{openInNewWindow:o,targetUrl:n}}})};return p?r(s,{...m,href:"#",onClick:i}):/* @__PURE__ */e("a",{...m,href:"#",onClick:i,children:s})}{if(!n)return p?s:/* @__PURE__ */e("span",{className:m.className,children:s});const i=n,t=o?"_blank":m.target;return p?r(s,{...m,href:i,target:t}):/* @__PURE__ */e("a",{...m,href:i,target:t,children:s})}}export{n as ExternalLinkBlock};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhoneLinkBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/PhoneLinkBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAwC,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAE3G,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"PhoneLinkBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/PhoneLinkBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAwC,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAE3G,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,UAAU,mBAAoB,SAAQ,aAAa,CAAC,kBAAkB,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC1H,QAAQ,EAAE,YAAY,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,cAAc,GAAI,+DAA+D,mBAAmB,4CAuBhH,CAAC"}
|
|
@@ -1,21 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { cloneElement } from "react";
|
|
3
|
-
const PhoneLinkBlock = ({ data: { phone }, children, legacyBehavior, ...anchorProps }) => {
|
|
4
|
-
if (!phone) {
|
|
5
|
-
if (legacyBehavior) {
|
|
6
|
-
return children;
|
|
7
|
-
}
|
|
8
|
-
return /* @__PURE__ */ jsx("span", { className: anchorProps.className, children });
|
|
9
|
-
}
|
|
10
|
-
const href = `tel:${phone}`;
|
|
11
|
-
if (legacyBehavior) {
|
|
12
|
-
return cloneElement(children, {
|
|
13
|
-
...anchorProps,
|
|
14
|
-
href
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
return /* @__PURE__ */ jsx("a", { ...anchorProps, href, children });
|
|
18
|
-
};
|
|
19
|
-
export {
|
|
20
|
-
PhoneLinkBlock
|
|
21
|
-
};
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{cloneElement as e}from"react";const a=({data:{phone:a},children:t,legacyBehavior:c,...n})=>{if(!a)return c?t:/* @__PURE__ */r("span",{className:n.className,children:t});const o=`tel:${a}`;return c?e(t,{...n,href:o}):/* @__PURE__ */r("a",{...n,href:o,children:t})};export{a as PhoneLinkBlock};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SvgImageBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/SvgImageBlock.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"SvgImageBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/SvgImageBlock.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAG7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,UAAU,kBAAmB,SAAQ,aAAa,CAAC,iBAAiB,CAAC;IACjE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;CACrC;AAED,eAAO,MAAM,aAAa,qLAsBzB,CAAC"}
|
|
@@ -1,29 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
import { withPreview } from "../iframebridge/withPreview.js";
|
|
4
|
-
import { PreviewSkeleton } from "../previewskeleton/PreviewSkeleton.js";
|
|
5
|
-
const SvgImageBlock = withPreview(
|
|
6
|
-
({
|
|
7
|
-
data: { damFile },
|
|
8
|
-
width = "100%",
|
|
9
|
-
height = "auto",
|
|
10
|
-
...restProps
|
|
11
|
-
}) => {
|
|
12
|
-
if (!damFile) return /* @__PURE__ */ jsx(PreviewSkeleton, { type: "media", hasContent: false, height: height === "auto" ? void 0 : height });
|
|
13
|
-
return /* @__PURE__ */ jsx(
|
|
14
|
-
"img",
|
|
15
|
-
{
|
|
16
|
-
src: damFile.fileUrl,
|
|
17
|
-
width: width === "auto" ? void 0 : width,
|
|
18
|
-
height: height === "auto" ? void 0 : height,
|
|
19
|
-
alt: damFile.altText ?? "",
|
|
20
|
-
title: damFile.title ?? "",
|
|
21
|
-
...restProps
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
},
|
|
25
|
-
{ label: "SvgImage" }
|
|
26
|
-
);
|
|
27
|
-
export {
|
|
28
|
-
SvgImageBlock
|
|
29
|
-
};
|
|
2
|
+
import{jsx as t}from"react/jsx-runtime";import{withPreview as e}from"../iframebridge/withPreview.js";import{PreviewSkeleton as i}from"../previewskeleton/PreviewSkeleton.js";const o=e(({data:{damFile:e},width:o="100%",height:r="auto",...a})=>e?/* @__PURE__ */t("img",{src:e.fileUrl,width:"auto"===o?void 0:o,height:"auto"===r?void 0:r,alt:e.altText??"",title:e.title??"",...a}):/* @__PURE__ */t(i,{type:"media",hasContent:!1,height:"auto"===r?void 0:r}),{label:"SvgImage"});export{o as SvgImageBlock};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VimeoVideoBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/VimeoVideoBlock.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAiC,MAAM,OAAO,CAAC;AAE7G,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"VimeoVideoBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/VimeoVideoBlock.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAiC,MAAM,OAAO,CAAC;AAE7G,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG/D,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEvF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAqBrD,UAAU,oBAAqB,SAAQ,aAAa,CAAC,mBAAmB,CAAC;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,YAAY,CAAC;IACpE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,eAAe,CAAC,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;CACzD;AAED,eAAO,MAAM,eAAe,0HAwH3B,CAAC"}
|
|
@@ -1,120 +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 "./VimeoVideoBlock.module.scss.js";
|
|
10
|
-
function parseVimeoIdentifier(vimeoIdentifier) {
|
|
11
|
-
const urlRegEx = /^(https?:\/\/)?((www\.|player\.)?vimeo\.com\/?(showcase\/)*([0-9a-z]*\/)*([0-9]{6,11})[?]?.*)$/;
|
|
12
|
-
const idRegEx = /^([0-9]{6,11})$/;
|
|
13
|
-
const urlRegExMatch = vimeoIdentifier.match(urlRegEx);
|
|
14
|
-
const idRegExMatch = vimeoIdentifier.match(idRegEx);
|
|
15
|
-
if (!urlRegExMatch && !idRegExMatch) return void 0;
|
|
16
|
-
if (urlRegExMatch) {
|
|
17
|
-
return urlRegExMatch[6];
|
|
18
|
-
} else if (idRegExMatch) {
|
|
19
|
-
return idRegExMatch[1];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
const VimeoVideoBlock = withPreview(
|
|
23
|
-
({
|
|
24
|
-
data: { vimeoIdentifier, autoplay, loop, showControls, previewImage },
|
|
25
|
-
aspectRatio = "16x9",
|
|
26
|
-
previewImageSizes,
|
|
27
|
-
renderPreviewImage,
|
|
28
|
-
fill,
|
|
29
|
-
previewImageIcon,
|
|
30
|
-
playButtonAriaLabel,
|
|
31
|
-
pauseButtonAriaLabel,
|
|
32
|
-
playPauseButton: PlayPauseButtonComponent
|
|
33
|
-
}) => {
|
|
34
|
-
const [showPreviewImage, setShowPreviewImage] = useState(true);
|
|
35
|
-
const hasPreviewImage = !!(previewImage && previewImage.damFile);
|
|
36
|
-
const inViewRef = useRef(null);
|
|
37
|
-
const [iframeElement, setIframeElement] = useState(null);
|
|
38
|
-
const iframeRef = setIframeElement;
|
|
39
|
-
const [isPlaying, setIsPlaying] = useState(autoplay ?? false);
|
|
40
|
-
const [isHandledManually, setIsHandledManually] = useState(false);
|
|
41
|
-
const pauseVimeoVideo = useCallback(() => {
|
|
42
|
-
var _a;
|
|
43
|
-
(_a = iframeElement == null ? void 0 : iframeElement.contentWindow) == null ? void 0 : _a.postMessage(JSON.stringify({ method: "pause" }), "https://player.vimeo.com");
|
|
44
|
-
}, [iframeElement]);
|
|
45
|
-
const playVimeoVideo = useCallback(() => {
|
|
46
|
-
var _a;
|
|
47
|
-
(_a = iframeElement == null ? void 0 : iframeElement.contentWindow) == null ? void 0 : _a.postMessage(JSON.stringify({ method: "play" }), "https://player.vimeo.com");
|
|
48
|
-
}, [iframeElement]);
|
|
49
|
-
const handleInView = useCallback(
|
|
50
|
-
(isVisible) => {
|
|
51
|
-
if (!isHandledManually) {
|
|
52
|
-
if (isVisible && autoplay) {
|
|
53
|
-
playVimeoVideo();
|
|
54
|
-
setIsPlaying(true);
|
|
55
|
-
} else {
|
|
56
|
-
pauseVimeoVideo();
|
|
57
|
-
setIsPlaying(false);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
[autoplay, isHandledManually, playVimeoVideo, pauseVimeoVideo]
|
|
62
|
-
);
|
|
63
|
-
useIsElementInViewport(inViewRef, handleInView);
|
|
64
|
-
if (!vimeoIdentifier) {
|
|
65
|
-
return /* @__PURE__ */ jsx(PreviewSkeleton, { type: "media", hasContent: false, aspectRatio });
|
|
66
|
-
}
|
|
67
|
-
const identifier = parseVimeoIdentifier(vimeoIdentifier);
|
|
68
|
-
const searchParams = new URLSearchParams();
|
|
69
|
-
if (hasPreviewImage && !showPreviewImage) searchParams.append("autoplay", "1");
|
|
70
|
-
if (autoplay) searchParams.append("muted", "1");
|
|
71
|
-
if (loop !== void 0) searchParams.append("loop", Number(loop).toString());
|
|
72
|
-
if (showControls !== void 0) searchParams.append("controls", Number(showControls).toString());
|
|
73
|
-
searchParams.append("dnt", "1");
|
|
74
|
-
const vimeoBaseUrl = "https://player.vimeo.com/video/";
|
|
75
|
-
const vimeoUrl = new URL(`${vimeoBaseUrl}${identifier ?? ""}`);
|
|
76
|
-
vimeoUrl.search = searchParams.toString();
|
|
77
|
-
const handlePlayPauseClick = () => {
|
|
78
|
-
if (isPlaying) {
|
|
79
|
-
setIsPlaying(false);
|
|
80
|
-
setIsHandledManually(true);
|
|
81
|
-
pauseVimeoVideo();
|
|
82
|
-
} else {
|
|
83
|
-
setIsPlaying(true);
|
|
84
|
-
playVimeoVideo();
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
return /* @__PURE__ */ jsx(Fragment, { children: hasPreviewImage && showPreviewImage ? renderPreviewImage({
|
|
88
|
-
onPlay: () => setShowPreviewImage(false),
|
|
89
|
-
image: previewImage,
|
|
90
|
-
aspectRatio,
|
|
91
|
-
sizes: previewImageSizes,
|
|
92
|
-
fill,
|
|
93
|
-
icon: previewImageIcon,
|
|
94
|
-
playButtonAriaLabel
|
|
95
|
-
}) : /* @__PURE__ */ jsxs(
|
|
96
|
-
"div",
|
|
97
|
-
{
|
|
98
|
-
ref: inViewRef,
|
|
99
|
-
className: clsx(styles.videoContainer, fill && styles.fill),
|
|
100
|
-
style: !fill ? { "--aspect-ratio": aspectRatio.replace("x", "/") } : void 0,
|
|
101
|
-
children: [
|
|
102
|
-
/* @__PURE__ */ jsx("iframe", { ref: iframeRef, className: styles.vimeoContainer, src: vimeoUrl.toString(), allow: "autoplay", allowFullScreen: true }),
|
|
103
|
-
!showControls && (PlayPauseButtonComponent ? /* @__PURE__ */ jsx(PlayPauseButtonComponent, { isPlaying, onClick: handlePlayPauseClick }) : /* @__PURE__ */ jsx(
|
|
104
|
-
PlayPauseButton,
|
|
105
|
-
{
|
|
106
|
-
isPlaying,
|
|
107
|
-
onClick: handlePlayPauseClick,
|
|
108
|
-
ariaLabelPlay: playButtonAriaLabel,
|
|
109
|
-
ariaLabelPause: pauseButtonAriaLabel
|
|
110
|
-
}
|
|
111
|
-
))
|
|
112
|
-
]
|
|
113
|
-
}
|
|
114
|
-
) });
|
|
115
|
-
},
|
|
116
|
-
{ label: "Video" }
|
|
117
|
-
);
|
|
118
|
-
export {
|
|
119
|
-
VimeoVideoBlock
|
|
120
|
-
};
|
|
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 c from"./VimeoVideoBlock.module.scss.js";const d=s(({data:{vimeoIdentifier:s,autoplay:d,loop:u,showControls:f,previewImage:v},aspectRatio:w="16x9",previewImageSizes:y,renderPreviewImage:h,fill:g,previewImageIcon:P,playButtonAriaLabel:S,pauseButtonAriaLabel:b,playPauseButton:I})=>{const[L,j]=i(!0),B=!(!v||!v.damFile),C=r(null),[N,k]=i(null),x=k,[R,V]=i(d??!1),[z,A]=i(!1),$=n(()=>{N?.contentWindow?.postMessage(JSON.stringify({method:"pause"}),"https://player.vimeo.com")},[N]),F=n(()=>{N?.contentWindow?.postMessage(JSON.stringify({method:"play"}),"https://player.vimeo.com")},[N]),J=n(e=>{z||(e&&d?(F(),V(!0)):($(),V(!1)))},[d,z,F,$]);if(m(C,J),!s)/* @__PURE__ */
|
|
3
|
+
return e(l,{type:"media",hasContent:!1,aspectRatio:w});const M=function(e){const o=e.match(/^(https?:\/\/)?((www\.|player\.)?vimeo\.com\/?(showcase\/)*([0-9a-z]*\/)*([0-9]{6,11})[?]?.*)$/),t=e.match(/^([0-9]{6,11})$/);if(o||t)return o?o[6]:t?t[1]:void 0}(s),O=new URLSearchParams;B&&!L&&O.append("autoplay","1"),d&&O.append("muted","1"),void 0!==u&&O.append("loop",Number(u).toString()),void 0!==f&&O.append("controls",Number(f).toString()),O.append("dnt","1");const U=new URL(`https://player.vimeo.com/video/${M??""}`);U.search=O.toString();const W=()=>{R?(V(!1),A(!0),$()):(V(!0),F())};/* @__PURE__ */
|
|
4
|
+
return e(o,{children:B&&L?h({onPlay:()=>j(!1),image:v,aspectRatio:w,sizes:y,fill:g,icon:P,playButtonAriaLabel:S}):/* @__PURE__ */t("div",{ref:C,className:a(c.videoContainer,g&&c.fill),style:g?void 0:{"--aspect-ratio":w.replace("x","/")},children:[
|
|
5
|
+
/* @__PURE__ */e("iframe",{ref:x,className:c.vimeoContainer,src:U.toString(),allow:"autoplay",allowFullScreen:!0}),!f&&(I?/* @__PURE__ */e(I,{isPlaying:R,onClick:W}):/* @__PURE__ */e(p,{isPlaying:R,onClick:W,ariaLabelPlay:S,ariaLabelPause:b}))]})})},{label:"Video"});export{d as VimeoVideoBlock};
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
const fill = "_fill_1flq1_7";
|
|
3
|
-
const vimeoContainer = "_vimeoContainer_1flq1_12";
|
|
4
|
-
const styles = {
|
|
5
|
-
videoContainer,
|
|
6
|
-
fill,
|
|
7
|
-
vimeoContainer
|
|
8
|
-
};
|
|
9
|
-
export {
|
|
10
|
-
styles as default,
|
|
11
|
-
fill,
|
|
12
|
-
videoContainer,
|
|
13
|
-
vimeoContainer
|
|
14
|
-
};
|
|
1
|
+
const e="_videoContainer_1flq1_1",i="_fill_1flq1_7",o="_vimeoContainer_1flq1_12",n={videoContainer:e,fill:i,vimeoContainer:o};export{n as default,i as fill,e as videoContainer,o as vimeoContainer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YouTubeVideoBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/YouTubeVideoBlock.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAiC,MAAM,OAAO,CAAC;AAE7G,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"YouTubeVideoBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/YouTubeVideoBlock.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAiC,MAAM,OAAO,CAAC;AAE7G,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAGjE,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEvF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAerD,UAAU,sBAAuB,SAAQ,aAAa,CAAC,qBAAqB,CAAC;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,YAAY,CAAC;IACpE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,eAAe,CAAC,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;CACzD;AAED,eAAO,MAAM,iBAAiB,4HAqI7B,CAAC"}
|