@comet/site-nextjs 7.21.0-canary-20250522145352

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.
Files changed (71) hide show
  1. package/LICENSE +24 -0
  2. package/lib/blocks/DamFileDownloadLinkBlock.d.ts +12 -0
  3. package/lib/blocks/DamFileDownloadLinkBlock.d.ts.map +1 -0
  4. package/lib/blocks/DamFileDownloadLinkBlock.js +24 -0
  5. package/lib/blocks/DamVideoBlock.d.ts +14 -0
  6. package/lib/blocks/DamVideoBlock.d.ts.map +1 -0
  7. package/lib/blocks/DamVideoBlock.js +64 -0
  8. package/lib/blocks/DamVideoBlock.module.scss.js +11 -0
  9. package/lib/blocks/EmailLinkBlock.d.ts +12 -0
  10. package/lib/blocks/EmailLinkBlock.d.ts.map +1 -0
  11. package/lib/blocks/EmailLinkBlock.js +18 -0
  12. package/lib/blocks/ExternalLinkBlock.d.ts +12 -0
  13. package/lib/blocks/ExternalLinkBlock.d.ts.map +1 -0
  14. package/lib/blocks/ExternalLinkBlock.js +40 -0
  15. package/lib/blocks/InternalLinkBlock.d.ts +14 -0
  16. package/lib/blocks/InternalLinkBlock.d.ts.map +1 -0
  17. package/lib/blocks/InternalLinkBlock.js +19 -0
  18. package/lib/blocks/PhoneLinkBlock.d.ts +12 -0
  19. package/lib/blocks/PhoneLinkBlock.d.ts.map +1 -0
  20. package/lib/blocks/PhoneLinkBlock.js +18 -0
  21. package/lib/blocks/PixelImageBlock.d.ts +13 -0
  22. package/lib/blocks/PixelImageBlock.d.ts.map +1 -0
  23. package/lib/blocks/PixelImageBlock.js +66 -0
  24. package/lib/blocks/PixelImageBlock.module.scss.js +8 -0
  25. package/lib/blocks/VimeoVideoBlock.d.ts +14 -0
  26. package/lib/blocks/VimeoVideoBlock.d.ts.map +1 -0
  27. package/lib/blocks/VimeoVideoBlock.js +90 -0
  28. package/lib/blocks/VimeoVideoBlock.module.scss.js +14 -0
  29. package/lib/blocks/YouTubeVideoBlock.d.ts +14 -0
  30. package/lib/blocks/YouTubeVideoBlock.d.ts.map +1 -0
  31. package/lib/blocks/YouTubeVideoBlock.js +99 -0
  32. package/lib/blocks/YouTubeVideoBlock.module.scss.js +14 -0
  33. package/lib/blocks/factories/SeoBlock.d.ts +20 -0
  34. package/lib/blocks/factories/SeoBlock.d.ts.map +1 -0
  35. package/lib/blocks/factories/SeoBlock.js +39 -0
  36. package/lib/blocks/helpers/VideoPreviewImage.d.ts +13 -0
  37. package/lib/blocks/helpers/VideoPreviewImage.d.ts.map +1 -0
  38. package/lib/blocks/helpers/VideoPreviewImage.js +14 -0
  39. package/lib/blocks/helpers/VideoPreviewImage.module.scss.js +17 -0
  40. package/lib/blocks.generated.d.ts +176 -0
  41. package/lib/blocks.generated.d.ts.map +1 -0
  42. package/lib/graphQLFetch/graphQLFetch.d.ts +4 -0
  43. package/lib/graphQLFetch/graphQLFetch.d.ts.map +1 -0
  44. package/lib/graphQLFetch/graphQLFetch.js +19 -0
  45. package/lib/image/Image.d.ts +7 -0
  46. package/lib/image/Image.d.ts.map +1 -0
  47. package/lib/image/Image.js +10 -0
  48. package/lib/index.d.ts +24 -0
  49. package/lib/index.d.ts.map +1 -0
  50. package/lib/index.js +75 -0
  51. package/lib/site-react/lib/style.css.js +1 -0
  52. package/lib/sitePreview/SitePreviewProvider.d.ts +3 -0
  53. package/lib/sitePreview/SitePreviewProvider.d.ts.map +1 -0
  54. package/lib/sitePreview/SitePreviewProvider.js +38 -0
  55. package/lib/sitePreview/SitePreviewUtils.d.ts +9 -0
  56. package/lib/sitePreview/SitePreviewUtils.d.ts.map +1 -0
  57. package/lib/sitePreview/SitePreviewUtils.js +17 -0
  58. package/lib/sitePreview/appRouter/sitePreviewRoute.d.ts +14 -0
  59. package/lib/sitePreview/appRouter/sitePreviewRoute.d.ts.map +1 -0
  60. package/lib/sitePreview/appRouter/sitePreviewRoute.js +40 -0
  61. package/lib/sitePreview/iframebridge/SitePreviewIFrameMessage.d.ts +17 -0
  62. package/lib/sitePreview/iframebridge/SitePreviewIFrameMessage.d.ts.map +1 -0
  63. package/lib/sitePreview/iframebridge/SitePreviewIFrameMessage.js +8 -0
  64. package/lib/sitePreview/iframebridge/sendSitePreviewIFrameMessage.d.ts +3 -0
  65. package/lib/sitePreview/iframebridge/sendSitePreviewIFrameMessage.d.ts.map +1 -0
  66. package/lib/sitePreview/iframebridge/sendSitePreviewIFrameMessage.js +6 -0
  67. package/lib/sitePreview/pagesRouter/legacyPagesRouterSitePreviewApiHandler.d.ts +4 -0
  68. package/lib/sitePreview/pagesRouter/legacyPagesRouterSitePreviewApiHandler.d.ts.map +1 -0
  69. package/lib/sitePreview/pagesRouter/legacyPagesRouterSitePreviewApiHandler.js +17 -0
  70. package/lib/style.css +1 -0
  71. package/package.json +87 -0
package/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+ BSD 2-Clause License
2
+
3
+ Copyright (c) 2023, Vivid Planet Software GmbH
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,12 @@
1
+ import { PropsWithData } from '@comet/site-react';
2
+ import { ReactElement } from 'react';
3
+ import { DamFileDownloadLinkBlockData } from '../blocks.generated';
4
+ interface Props extends PropsWithData<DamFileDownloadLinkBlockData> {
5
+ children: ReactElement;
6
+ title?: string;
7
+ className?: string;
8
+ legacyBehavior?: boolean;
9
+ }
10
+ export declare const DamFileDownloadLinkBlock: ({ ...componentProps }: import('@comet/site-react').WithPreviewProps & Props) => import("react/jsx-runtime").JSX.Element;
11
+ export {};
12
+ //# sourceMappingURL=DamFileDownloadLinkBlock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DamFileDownloadLinkBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/DamFileDownloadLinkBlock.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,OAAO,CAAC;AAExD,OAAO,EAAE,KAAK,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAExE,UAAU,KAAM,SAAQ,aAAa,CAAC,4BAA4B,CAAC;IAC/D,QAAQ,EAAE,YAAY,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,wBAAwB,0HAwBpC,CAAC"}
@@ -0,0 +1,24 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { withPreview } from "@comet/site-react";
4
+ import { cloneElement } from "react";
5
+ const DamFileDownloadLinkBlock = withPreview(
6
+ ({ data: { file, openFileType }, children, title, className, legacyBehavior }) => {
7
+ if (!file) {
8
+ if (legacyBehavior) {
9
+ return children;
10
+ }
11
+ return /* @__PURE__ */ jsx("span", { className, children });
12
+ }
13
+ const href = file.fileUrl;
14
+ const target = openFileType === "NewTab" ? "_blank" : void 0;
15
+ if (legacyBehavior) {
16
+ return cloneElement(children, { href, target, title });
17
+ }
18
+ return /* @__PURE__ */ jsx("a", { href, target, title, className, children });
19
+ },
20
+ { label: "DamFileDownloadLink" }
21
+ );
22
+ export {
23
+ DamFileDownloadLinkBlock
24
+ };
@@ -0,0 +1,14 @@
1
+ import { PropsWithData } from '@comet/site-react';
2
+ import { ReactElement, ReactNode } from 'react';
3
+ import { DamVideoBlockData } from '../blocks.generated';
4
+ import { VideoPreviewImageProps } from './helpers/VideoPreviewImage';
5
+ interface DamVideoBlockProps extends PropsWithData<DamVideoBlockData> {
6
+ aspectRatio?: string;
7
+ previewImageSizes?: string;
8
+ renderPreviewImage?: (props: VideoPreviewImageProps) => ReactElement;
9
+ fill?: boolean;
10
+ previewImageIcon?: ReactNode;
11
+ }
12
+ export declare const DamVideoBlock: ({ ...componentProps }: import('@comet/site-react').WithPreviewProps & DamVideoBlockProps) => import("react/jsx-runtime").JSX.Element;
13
+ export {};
14
+ //# sourceMappingURL=DamVideoBlock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DamVideoBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/DamVideoBlock.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAwD,MAAM,mBAAmB,CAAC;AAE7G,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAoB,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAE,KAAK,sBAAsB,EAAqB,MAAM,6BAA6B,CAAC;AAE7F,UAAU,kBAAmB,SAAQ,aAAa,CAAC,iBAAiB,CAAC;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,YAAY,CAAC;IACrE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,gBAAgB,CAAC,EAAE,SAAS,CAAC;CAChC;AAED,eAAO,MAAM,aAAa,uIAgEzB,CAAC"}
@@ -0,0 +1,64 @@
1
+ "use client";
2
+ import { jsx, Fragment } from "react/jsx-runtime";
3
+ import { withPreview, PreviewSkeleton, useIsElementInViewport } from "@comet/site-react";
4
+ import clsx from "clsx";
5
+ import { useState, useRef } from "react";
6
+ import styles from "./DamVideoBlock.module.scss.js";
7
+ import { VideoPreviewImage } from "./helpers/VideoPreviewImage.js";
8
+ const DamVideoBlock = withPreview(
9
+ ({
10
+ data: { damFile, autoplay, loop, showControls, previewImage },
11
+ aspectRatio = "16x9",
12
+ previewImageSizes,
13
+ renderPreviewImage,
14
+ fill,
15
+ previewImageIcon
16
+ }) => {
17
+ if (damFile === void 0) {
18
+ return /* @__PURE__ */ jsx(PreviewSkeleton, { type: "media", hasContent: false, aspectRatio });
19
+ }
20
+ const [showPreviewImage, setShowPreviewImage] = useState(true);
21
+ const hasPreviewImage = Boolean(previewImage && previewImage.damFile);
22
+ const videoRef = useRef(null);
23
+ useIsElementInViewport(videoRef, (inView) => {
24
+ if (autoplay && videoRef.current) {
25
+ inView ? videoRef.current.play() : videoRef.current.pause();
26
+ }
27
+ });
28
+ return /* @__PURE__ */ jsx(Fragment, { children: hasPreviewImage && showPreviewImage ? renderPreviewImage ? renderPreviewImage({
29
+ onPlay: () => setShowPreviewImage(false),
30
+ image: previewImage,
31
+ aspectRatio,
32
+ sizes: previewImageSizes,
33
+ fill,
34
+ icon: previewImageIcon
35
+ }) : /* @__PURE__ */ jsx(
36
+ VideoPreviewImage,
37
+ {
38
+ onPlay: () => setShowPreviewImage(false),
39
+ image: previewImage,
40
+ aspectRatio,
41
+ sizes: previewImageSizes,
42
+ fill,
43
+ icon: previewImageIcon
44
+ }
45
+ ) : /* @__PURE__ */ jsx(
46
+ "video",
47
+ {
48
+ autoPlay: autoplay || hasPreviewImage && !showPreviewImage,
49
+ controls: showControls,
50
+ loop,
51
+ playsInline: true,
52
+ muted: autoplay,
53
+ ref: videoRef,
54
+ className: clsx(styles.video, fill && styles.fill),
55
+ style: !fill ? { "--aspect-ratio": aspectRatio.replace("x", " / ") } : void 0,
56
+ children: /* @__PURE__ */ jsx("source", { src: damFile.fileUrl, type: damFile.mimetype })
57
+ }
58
+ ) });
59
+ },
60
+ { label: "Video" }
61
+ );
62
+ export {
63
+ DamVideoBlock
64
+ };
@@ -0,0 +1,11 @@
1
+ const video = "_video_17b8y_1";
2
+ const fill = "_fill_17b8y_7";
3
+ const styles = {
4
+ video,
5
+ fill
6
+ };
7
+ export {
8
+ styles as default,
9
+ fill,
10
+ video
11
+ };
@@ -0,0 +1,12 @@
1
+ import { PropsWithData } from '@comet/site-react';
2
+ import { ReactElement } from 'react';
3
+ import { EmailLinkBlockData } from '../blocks.generated';
4
+ interface EmailLinkBlockProps extends PropsWithData<EmailLinkBlockData> {
5
+ children: ReactElement;
6
+ title?: string;
7
+ className?: string;
8
+ legacyBehavior?: boolean;
9
+ }
10
+ export declare const EmailLinkBlock: ({ data: { email }, children, title, className, legacyBehavior }: EmailLinkBlockProps) => import("react/jsx-runtime").JSX.Element;
11
+ export {};
12
+ //# sourceMappingURL=EmailLinkBlock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmailLinkBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/EmailLinkBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,OAAO,CAAC;AAExD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,UAAU,mBAAoB,SAAQ,aAAa,CAAC,kBAAkB,CAAC;IACnE,QAAQ,EAAE,YAAY,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,cAAc,oEAAqE,mBAAmB,4CAoBlH,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { cloneElement } from "react";
3
+ const EmailLinkBlock = ({ data: { email }, children, title, className, legacyBehavior }) => {
4
+ if (!email) {
5
+ if (legacyBehavior) {
6
+ return children;
7
+ }
8
+ return /* @__PURE__ */ jsx("span", { className, children });
9
+ }
10
+ const href = `mailto:${email}`;
11
+ if (legacyBehavior) {
12
+ return cloneElement(children, { href, title });
13
+ }
14
+ return /* @__PURE__ */ jsx("a", { href, title, className, children });
15
+ };
16
+ export {
17
+ EmailLinkBlock
18
+ };
@@ -0,0 +1,12 @@
1
+ import { PropsWithData } from '@comet/site-react';
2
+ import { ReactElement } from 'react';
3
+ import { ExternalLinkBlockData } from '../blocks.generated';
4
+ interface ExternalLinkBlockProps extends PropsWithData<ExternalLinkBlockData> {
5
+ children: ReactElement;
6
+ title?: string;
7
+ className?: string;
8
+ legacyBehavior?: boolean;
9
+ }
10
+ export declare function ExternalLinkBlock({ data: { targetUrl, openInNewWindow }, children, title, className, legacyBehavior }: ExternalLinkBlockProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
12
+ //# sourceMappingURL=ExternalLinkBlock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExternalLinkBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/ExternalLinkBlock.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAc,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAA0B,KAAK,YAAY,EAAgB,MAAM,OAAO,CAAC;AAEhF,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAIjE,UAAU,sBAAuB,SAAQ,aAAa,CAAC,qBAAqB,CAAC;IACzE,QAAQ,EAAE,YAAY,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,wBAAgB,iBAAiB,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,EAAE,sBAAsB,2CA8C7I"}
@@ -0,0 +1,40 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { usePreview } from "@comet/site-react";
4
+ import { cloneElement } from "react";
5
+ import { sendSitePreviewIFrameMessage } from "../sitePreview/iframebridge/sendSitePreviewIFrameMessage.js";
6
+ import { SitePreviewIFrameMessageType } from "../sitePreview/iframebridge/SitePreviewIFrameMessage.js";
7
+ function ExternalLinkBlock({ data: { targetUrl, openInNewWindow }, children, title, className, legacyBehavior }) {
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, { href: "#", onClick, title });
21
+ }
22
+ return /* @__PURE__ */ jsx("a", { href: "#", onClick, title, className, children });
23
+ } else {
24
+ if (!targetUrl) {
25
+ if (legacyBehavior) {
26
+ return children;
27
+ }
28
+ return /* @__PURE__ */ jsx("span", { className, children });
29
+ }
30
+ const href = targetUrl;
31
+ const target = openInNewWindow ? "_blank" : void 0;
32
+ if (legacyBehavior) {
33
+ return cloneElement(children, { href, target, title });
34
+ }
35
+ return /* @__PURE__ */ jsx("a", { href, target, title, className, children });
36
+ }
37
+ }
38
+ export {
39
+ ExternalLinkBlock
40
+ };
@@ -0,0 +1,14 @@
1
+ import { PropsWithData } from '@comet/site-react';
2
+ import { PropsWithChildren } from 'react';
3
+ import { InternalLinkBlockData } from '../blocks.generated';
4
+ interface InternalLinkBlockProps extends PropsWithChildren<PropsWithData<InternalLinkBlockData>> {
5
+ title?: string;
6
+ className?: string;
7
+ legacyBehavior?: boolean;
8
+ }
9
+ /**
10
+ * @deprecated There should be a copy of this component in the application for flexibility (e.g. multi language support)
11
+ */
12
+ export declare function InternalLinkBlock({ data: { targetPage, targetPageAnchor }, children, title, className, legacyBehavior }: InternalLinkBlockProps): import("react/jsx-runtime").JSX.Element;
13
+ export {};
14
+ //# sourceMappingURL=InternalLinkBlock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InternalLinkBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/InternalLinkBlock.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAEjE,UAAU,sBAAuB,SAAQ,iBAAiB,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAC5F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,EAAE,sBAAsB,2CAwB/I"}
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { jsx, Fragment } from "react/jsx-runtime";
3
+ import Link from "next/link";
4
+ function InternalLinkBlock({ data: { targetPage, targetPageAnchor }, children, title, className, legacyBehavior }) {
5
+ if (!targetPage) {
6
+ if (legacyBehavior) {
7
+ return /* @__PURE__ */ jsx(Fragment, { children });
8
+ }
9
+ return /* @__PURE__ */ jsx("span", { className, children });
10
+ }
11
+ const href = targetPageAnchor !== void 0 ? `${targetPage.path}#${targetPageAnchor}` : targetPage.path;
12
+ if (legacyBehavior) {
13
+ return /* @__PURE__ */ jsx(Link, { href, title, passHref: true, legacyBehavior: true, children });
14
+ }
15
+ return /* @__PURE__ */ jsx(Link, { href, title, className, children });
16
+ }
17
+ export {
18
+ InternalLinkBlock
19
+ };
@@ -0,0 +1,12 @@
1
+ import { PropsWithData } from '@comet/site-react';
2
+ import { ReactElement } from 'react';
3
+ import { PhoneLinkBlockData } from '../blocks.generated';
4
+ interface PhoneLinkBlockProps extends PropsWithData<PhoneLinkBlockData> {
5
+ children: ReactElement;
6
+ title?: string;
7
+ className?: string;
8
+ legacyBehavior?: boolean;
9
+ }
10
+ export declare const PhoneLinkBlock: ({ data: { phone }, children, title, className, legacyBehavior }: PhoneLinkBlockProps) => import("react/jsx-runtime").JSX.Element;
11
+ export {};
12
+ //# sourceMappingURL=PhoneLinkBlock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PhoneLinkBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/PhoneLinkBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,OAAO,CAAC;AAExD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,UAAU,mBAAoB,SAAQ,aAAa,CAAC,kBAAkB,CAAC;IACnE,QAAQ,EAAE,YAAY,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,cAAc,oEAAqE,mBAAmB,4CAoBlH,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { cloneElement } from "react";
3
+ const PhoneLinkBlock = ({ data: { phone }, children, title, className, legacyBehavior }) => {
4
+ if (!phone) {
5
+ if (legacyBehavior) {
6
+ return children;
7
+ }
8
+ return /* @__PURE__ */ jsx("span", { className, children });
9
+ }
10
+ const href = `tel:${phone}`;
11
+ if (legacyBehavior) {
12
+ return cloneElement(children, { href, title });
13
+ }
14
+ return /* @__PURE__ */ jsx("a", { href, title, className, children });
15
+ };
16
+ export {
17
+ PhoneLinkBlock
18
+ };
@@ -0,0 +1,13 @@
1
+ import { PropsWithData } from '@comet/site-react';
2
+ import { ImageProps } from 'next/image';
3
+ import { PixelImageBlockData } from '../blocks.generated';
4
+ interface PixelImageBlockProps extends PropsWithData<PixelImageBlockData>, Omit<ImageProps, "src" | "width" | "height" | "alt"> {
5
+ aspectRatio: string | number | "inherit";
6
+ /**
7
+ * Do not set an `alt` attribute. The alt text is set in the DAM.
8
+ */
9
+ alt?: never;
10
+ }
11
+ export declare const PixelImageBlock: ({ ...componentProps }: import('@comet/site-react').WithPreviewProps & PixelImageBlockProps) => import("react/jsx-runtime").JSX.Element;
12
+ export {};
13
+ //# sourceMappingURL=PixelImageBlock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PixelImageBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/PixelImageBlock.tsx"],"names":[],"mappings":"AACA,OAAO,EAEH,KAAK,aAAa,EAOrB,MAAM,mBAAmB,CAAC;AAE3B,OAAkB,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAExD,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG/D,UAAU,oBAAqB,SAAQ,aAAa,CAAC,mBAAmB,CAAC,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IAC3H,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACzC;;OAEG;IACH,GAAG,CAAC,EAAE,KAAK,CAAC;CACf;AAED,eAAO,MAAM,eAAe,yIAiE3B,CAAC"}
@@ -0,0 +1,66 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { withPreview, PreviewSkeleton, calculateInheritAspectRatio, parseAspectRatio, getMaxDimensionsFromArea, generateImageUrl } from "@comet/site-react";
4
+ import NextImage from "next/image";
5
+ import styles from "./PixelImageBlock.module.scss.js";
6
+ const PixelImageBlock = withPreview(
7
+ ({ aspectRatio, data: { damFile, cropArea, urlTemplate }, fill, ...nextImageProps }) => {
8
+ if (!damFile || !damFile.image)
9
+ return /* @__PURE__ */ jsx(PreviewSkeleton, { type: "media", hasContent: false, aspectRatio });
10
+ const usedCropArea = cropArea ?? damFile.image.cropArea;
11
+ let usedAspectRatio;
12
+ if (aspectRatio === "inherit") {
13
+ usedAspectRatio = calculateInheritAspectRatio(damFile.image, usedCropArea);
14
+ } else {
15
+ usedAspectRatio = parseAspectRatio(aspectRatio);
16
+ }
17
+ let dimensions;
18
+ if (usedCropArea.width && usedCropArea.height) {
19
+ dimensions = getMaxDimensionsFromArea(
20
+ {
21
+ width: usedCropArea.width * damFile.image.width / 100,
22
+ height: usedCropArea.height * damFile.image.height / 100
23
+ },
24
+ usedAspectRatio
25
+ );
26
+ } else {
27
+ dimensions = getMaxDimensionsFromArea(
28
+ {
29
+ width: damFile.image.width,
30
+ height: damFile.image.height
31
+ },
32
+ usedAspectRatio
33
+ );
34
+ }
35
+ const blurDataUrl = createDominantImageDataUrl(dimensions.width, dimensions.height, damFile.image.dominantColor);
36
+ const nextImage = /* @__PURE__ */ jsx(
37
+ NextImage,
38
+ {
39
+ loader: (loaderProps) => generateImageUrl(loaderProps, usedAspectRatio),
40
+ src: urlTemplate,
41
+ fill: true,
42
+ style: { objectFit: "cover" },
43
+ placeholder: "blur",
44
+ blurDataURL: blurDataUrl,
45
+ alt: damFile.altText ?? "",
46
+ ...nextImageProps
47
+ }
48
+ );
49
+ if (fill) {
50
+ return nextImage;
51
+ }
52
+ return /* @__PURE__ */ jsx("div", { className: styles.imageContainer, style: { "--aspect-ratio": usedAspectRatio }, children: nextImage });
53
+ },
54
+ { label: "PixelImage" }
55
+ );
56
+ function createDominantImageDataUrl(w, h, dominantColor = "#ffffff") {
57
+ const toBase64 = (str) => typeof window === "undefined" ? Buffer.from(str).toString("base64") : window.btoa(str);
58
+ const svg = `
59
+ <svg width="${w}" height="${h}" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
60
+ <rect width="${w}" height="${h}" fill="${dominantColor}" />
61
+ </svg>`;
62
+ return `data:image/svg+xml;base64,${toBase64(svg)}`;
63
+ }
64
+ export {
65
+ PixelImageBlock
66
+ };
@@ -0,0 +1,8 @@
1
+ const imageContainer = "_imageContainer_13azr_1";
2
+ const styles = {
3
+ imageContainer
4
+ };
5
+ export {
6
+ styles as default,
7
+ imageContainer
8
+ };
@@ -0,0 +1,14 @@
1
+ import { PropsWithData } from '@comet/site-react';
2
+ import { ReactNode } from 'react';
3
+ import { VimeoVideoBlockData } from '../blocks.generated';
4
+ import { VideoPreviewImageProps } from './helpers/VideoPreviewImage';
5
+ interface VimeoVideoBlockProps extends PropsWithData<VimeoVideoBlockData> {
6
+ aspectRatio?: string;
7
+ previewImageSizes?: string;
8
+ renderPreviewImage?: (props: VideoPreviewImageProps) => React.ReactElement;
9
+ fill?: boolean;
10
+ previewImageIcon?: ReactNode;
11
+ }
12
+ export declare const VimeoVideoBlock: ({ ...componentProps }: import('@comet/site-react').WithPreviewProps & VimeoVideoBlockProps) => import("react/jsx-runtime").JSX.Element;
13
+ export {};
14
+ //# sourceMappingURL=VimeoVideoBlock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VimeoVideoBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/VimeoVideoBlock.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAwD,MAAM,mBAAmB,CAAC;AAE7G,OAAO,EAAE,KAAK,SAAS,EAAoB,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,KAAK,sBAAsB,EAAqB,MAAM,6BAA6B,CAAC;AAmB7F,UAAU,oBAAqB,SAAQ,aAAa,CAAC,mBAAmB,CAAC;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,KAAK,CAAC,YAAY,CAAC;IAC3E,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,gBAAgB,CAAC,EAAE,SAAS,CAAC;CAChC;AAED,eAAO,MAAM,eAAe,yIA+E3B,CAAC"}
@@ -0,0 +1,90 @@
1
+ "use client";
2
+ import { jsx, Fragment } from "react/jsx-runtime";
3
+ import { withPreview, useIsElementInViewport, PreviewSkeleton } from "@comet/site-react";
4
+ import clsx from "clsx";
5
+ import { useState, useRef } from "react";
6
+ import { VideoPreviewImage } from "./helpers/VideoPreviewImage.js";
7
+ import styles from "./VimeoVideoBlock.module.scss.js";
8
+ function parseVimeoIdentifier(vimeoIdentifier) {
9
+ const urlRegEx = /^(https?:\/\/)?((www\.|player\.)?vimeo\.com\/?(showcase\/)*([0-9a-z]*\/)*([0-9]{6,11})[?]?.*)$/;
10
+ const idRegEx = /^([0-9]{6,11})$/;
11
+ const urlRegExMatch = vimeoIdentifier.match(urlRegEx);
12
+ const idRegExMatch = vimeoIdentifier.match(idRegEx);
13
+ if (!urlRegExMatch && !idRegExMatch)
14
+ return void 0;
15
+ if (urlRegExMatch) {
16
+ return urlRegExMatch[6];
17
+ } else if (idRegExMatch) {
18
+ return idRegExMatch[1];
19
+ }
20
+ }
21
+ const VimeoVideoBlock = withPreview(
22
+ ({
23
+ data: { vimeoIdentifier, autoplay, loop, showControls, previewImage },
24
+ aspectRatio = "16x9",
25
+ previewImageSizes,
26
+ renderPreviewImage,
27
+ fill,
28
+ previewImageIcon
29
+ }) => {
30
+ const [showPreviewImage, setShowPreviewImage] = useState(true);
31
+ const hasPreviewImage = !!(previewImage && previewImage.damFile);
32
+ const inViewRef = useRef(null);
33
+ const iframeRef = useRef(null);
34
+ const handleVisibilityChange = (isVisible) => {
35
+ var _a;
36
+ if ((_a = iframeRef.current) == null ? void 0 : _a.contentWindow) {
37
+ iframeRef.current.contentWindow.postMessage(
38
+ JSON.stringify({ method: isVisible && autoplay ? "play" : "pause" }),
39
+ "https://player.vimeo.com"
40
+ );
41
+ }
42
+ };
43
+ useIsElementInViewport(inViewRef, handleVisibilityChange);
44
+ if (!vimeoIdentifier) {
45
+ return /* @__PURE__ */ jsx(PreviewSkeleton, { type: "media", hasContent: false, aspectRatio });
46
+ }
47
+ const identifier = parseVimeoIdentifier(vimeoIdentifier);
48
+ const searchParams = new URLSearchParams();
49
+ if (autoplay)
50
+ searchParams.append("muted", "1");
51
+ if (loop !== void 0)
52
+ searchParams.append("loop", Number(loop).toString());
53
+ if (showControls !== void 0)
54
+ searchParams.append("controls", Number(showControls).toString());
55
+ searchParams.append("dnt", "1");
56
+ const vimeoBaseUrl = "https://player.vimeo.com/video/";
57
+ const vimeoUrl = new URL(`${vimeoBaseUrl}${identifier ?? ""}`);
58
+ vimeoUrl.search = searchParams.toString();
59
+ return /* @__PURE__ */ jsx(Fragment, { children: hasPreviewImage && showPreviewImage ? renderPreviewImage ? renderPreviewImage({
60
+ onPlay: () => setShowPreviewImage(false),
61
+ image: previewImage,
62
+ aspectRatio,
63
+ sizes: previewImageSizes,
64
+ fill,
65
+ icon: previewImageIcon
66
+ }) : /* @__PURE__ */ jsx(
67
+ VideoPreviewImage,
68
+ {
69
+ onPlay: () => setShowPreviewImage(false),
70
+ image: previewImage,
71
+ aspectRatio,
72
+ sizes: previewImageSizes,
73
+ fill,
74
+ icon: previewImageIcon
75
+ }
76
+ ) : /* @__PURE__ */ jsx(
77
+ "div",
78
+ {
79
+ ref: inViewRef,
80
+ className: clsx(styles.videoContainer, fill && styles.fill),
81
+ style: !fill ? { "--aspect-ratio": aspectRatio.replace("x", "/") } : void 0,
82
+ children: /* @__PURE__ */ jsx("iframe", { ref: iframeRef, className: styles.vimeoContainer, src: vimeoUrl.toString(), allow: "autoplay", allowFullScreen: true })
83
+ }
84
+ ) });
85
+ },
86
+ { label: "Video" }
87
+ );
88
+ export {
89
+ VimeoVideoBlock
90
+ };
@@ -0,0 +1,14 @@
1
+ const videoContainer = "_videoContainer_1flq1_1";
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
+ };
@@ -0,0 +1,14 @@
1
+ import { PropsWithData } from '@comet/site-react';
2
+ import { ReactElement, ReactNode } from 'react';
3
+ import { YouTubeVideoBlockData } from '../blocks.generated';
4
+ import { VideoPreviewImageProps } from './helpers/VideoPreviewImage';
5
+ interface YouTubeVideoBlockProps extends PropsWithData<YouTubeVideoBlockData> {
6
+ aspectRatio?: string;
7
+ previewImageSizes?: string;
8
+ renderPreviewImage?: (props: VideoPreviewImageProps) => ReactElement;
9
+ fill?: boolean;
10
+ previewImageIcon?: ReactNode;
11
+ }
12
+ export declare const YouTubeVideoBlock: ({ ...componentProps }: import('@comet/site-react').WithPreviewProps & YouTubeVideoBlockProps) => import("react/jsx-runtime").JSX.Element;
13
+ export {};
14
+ //# sourceMappingURL=YouTubeVideoBlock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"YouTubeVideoBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/YouTubeVideoBlock.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAwD,MAAM,mBAAmB,CAAC;AAE7G,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAoB,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,KAAK,sBAAsB,EAAqB,MAAM,6BAA6B,CAAC;AAc7F,UAAU,sBAAuB,SAAQ,aAAa,CAAC,qBAAqB,CAAC;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,YAAY,CAAC;IACrE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,gBAAgB,CAAC,EAAE,SAAS,CAAC;CAChC;AAED,eAAO,MAAM,iBAAiB,2IA4F7B,CAAC"}