@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.
Files changed (103) hide show
  1. package/lib/blockLoader/blockLoader.d.ts.map +1 -1
  2. package/lib/blockLoader/blockLoader.js +1 -55
  3. package/lib/blocks/DamFileDownloadLinkBlock.d.ts.map +1 -1
  4. package/lib/blocks/DamFileDownloadLinkBlock.js +1 -27
  5. package/lib/blocks/DamVideoBlock.d.ts.map +1 -1
  6. package/lib/blocks/DamVideoBlock.js +5 -99
  7. package/lib/blocks/DamVideoBlock.module.scss.js +1 -14
  8. package/lib/blocks/EmailLinkBlock.d.ts.map +1 -1
  9. package/lib/blocks/EmailLinkBlock.js +1 -21
  10. package/lib/blocks/ExternalLinkBlock.d.ts.map +1 -1
  11. package/lib/blocks/ExternalLinkBlock.js +1 -47
  12. package/lib/blocks/PhoneLinkBlock.d.ts.map +1 -1
  13. package/lib/blocks/PhoneLinkBlock.js +1 -21
  14. package/lib/blocks/SvgImageBlock.d.ts.map +1 -1
  15. package/lib/blocks/SvgImageBlock.js +1 -28
  16. package/lib/blocks/VimeoVideoBlock.d.ts.map +1 -1
  17. package/lib/blocks/VimeoVideoBlock.js +4 -119
  18. package/lib/blocks/VimeoVideoBlock.module.scss.js +1 -14
  19. package/lib/blocks/YouTubeVideoBlock.d.ts.map +1 -1
  20. package/lib/blocks/YouTubeVideoBlock.js +4 -126
  21. package/lib/blocks/YouTubeVideoBlock.module.scss.js +1 -14
  22. package/lib/blocks/factories/BlocksBlock.d.ts.map +1 -1
  23. package/lib/blocks/factories/BlocksBlock.js +1 -27
  24. package/lib/blocks/factories/ListBlock.js +1 -13
  25. package/lib/blocks/factories/OneOfBlock.d.ts.map +1 -1
  26. package/lib/blocks/factories/OneOfBlock.js +1 -23
  27. package/lib/blocks/factories/OptionalBlock.d.ts.map +1 -1
  28. package/lib/blocks/factories/OptionalBlock.js +1 -10
  29. package/lib/blocks/factories/types.d.ts.map +1 -1
  30. package/lib/blocks/helpers/PlayPauseButton.js +1 -9
  31. package/lib/blocks/helpers/PlayPauseButton.module.scss.js +1 -14
  32. package/lib/blocks/helpers/RichTextBlockHelper.d.ts.map +1 -1
  33. package/lib/blocks/helpers/RichTextBlockHelper.js +1 -7
  34. package/lib/blocks/helpers/TipTapRichTextRenderer.d.ts +35 -0
  35. package/lib/blocks/helpers/TipTapRichTextRenderer.d.ts.map +1 -0
  36. package/lib/blocks/helpers/TipTapRichTextRenderer.js +3 -0
  37. package/lib/blocks/helpers/VideoPreviewImage.d.ts.map +1 -1
  38. package/lib/blocks/helpers/VideoPreviewImage.js +2 -23
  39. package/lib/blocks/helpers/VideoPreviewImage.module.scss.js +1 -17
  40. package/lib/blocks/helpers/useIsElementInViewport.d.ts.map +1 -1
  41. package/lib/blocks/helpers/useIsElementInViewport.js +1 -19
  42. package/lib/cookies/CookieApiContext.js +2 -18
  43. package/lib/cookies/CookieSafe.d.ts.map +1 -1
  44. package/lib/cookies/CookieSafe.js +2 -18
  45. package/lib/cookies/useCookieBotCookieApi.d.ts.map +1 -1
  46. package/lib/cookies/useCookieBotCookieApi.js +1 -33
  47. package/lib/cookies/useLocalStorageCookieApi.d.ts.map +1 -1
  48. package/lib/cookies/useLocalStorageCookieApi.js +1 -40
  49. package/lib/cookies/useOneTrustCookieApi.d.ts.map +1 -1
  50. package/lib/cookies/useOneTrustCookieApi.js +1 -48
  51. package/lib/errorHandler/ErrorHandlerBoundary.d.ts.map +1 -1
  52. package/lib/errorHandler/ErrorHandlerBoundary.js +2 -10
  53. package/lib/errorHandler/ErrorHandlerBoundaryInternal.js +1 -26
  54. package/lib/errorHandler/ErrorHandlerProvider.js +2 -20
  55. package/lib/graphQLFetch/fetchInMemoryCache.js +1 -37
  56. package/lib/graphQLFetch/graphQLFetch.js +1 -125
  57. package/lib/iframebridge/IFrameBridge.js +4 -253
  58. package/lib/iframebridge/IFrameBridge.module.scss.js +1 -8
  59. package/lib/iframebridge/IFrameMessage.d.ts.map +1 -1
  60. package/lib/iframebridge/IFrameMessage.js +1 -21
  61. package/lib/iframebridge/Preview.js +1 -56
  62. package/lib/iframebridge/Preview.module.scss.js +1 -8
  63. package/lib/iframebridge/PreviewOverlay.d.ts.map +1 -1
  64. package/lib/iframebridge/PreviewOverlay.js +1 -26
  65. package/lib/iframebridge/PreviewOverlay.module.scss.js +1 -8
  66. package/lib/iframebridge/PreviewOverlayElement.d.ts.map +1 -1
  67. package/lib/iframebridge/PreviewOverlayElement.js +2 -36
  68. package/lib/iframebridge/PreviewOverlayElement.module.scss.js +1 -20
  69. package/lib/iframebridge/useBlockPreviewFetch.js +1 -29
  70. package/lib/iframebridge/useIFrameBridge.js +1 -8
  71. package/lib/iframebridge/utils.d.ts.map +1 -1
  72. package/lib/iframebridge/utils.js +1 -44
  73. package/lib/iframebridge/withPreview.js +1 -33
  74. package/lib/image/Image.d.ts.map +1 -1
  75. package/lib/image/Image.js +2 -10
  76. package/lib/image/image.utils.d.ts.map +1 -1
  77. package/lib/image/image.utils.js +1 -51
  78. package/lib/index.d.ts +2 -2
  79. package/lib/index.d.ts.map +1 -1
  80. package/lib/index.js +1 -96
  81. package/lib/jsonLd/JsonLd.d.ts +7 -0
  82. package/lib/jsonLd/JsonLd.d.ts.map +1 -0
  83. package/lib/jsonLd/JsonLd.js +1 -0
  84. package/lib/persistedQueries/createPersistedQueryGraphQLFetch.d.ts.map +1 -1
  85. package/lib/persistedQueries/createPersistedQueryGraphQLFetch.js +1 -68
  86. package/lib/persistedQueries/persistedQueryRoute.js +1 -100
  87. package/lib/persistedQueries/webpackPersistedQueriesLoader.js +1 -51
  88. package/lib/preview/BlockPreviewProvider.d.ts.map +1 -1
  89. package/lib/preview/BlockPreviewProvider.js +1 -32
  90. package/lib/preview/PreviewContext.js +1 -9
  91. package/lib/preview/usePreview.js +1 -41
  92. package/lib/previewskeleton/PreviewSkeleton.d.ts.map +1 -1
  93. package/lib/previewskeleton/PreviewSkeleton.js +8 -64
  94. package/lib/previewskeleton/PreviewSkeleton.module.scss.js +1 -17
  95. package/lib/server.d.ts +2 -0
  96. package/lib/server.d.ts.map +1 -0
  97. package/lib/server.js +1 -0
  98. package/lib/sitePreview/iframebridge/SitePreviewIFrameMessage.d.ts.map +1 -1
  99. package/lib/sitePreview/iframebridge/SitePreviewIFrameMessage.js +1 -8
  100. package/lib/sitePreview/iframebridge/sendSitePreviewIFrameMessage.d.ts.map +1 -1
  101. package/lib/sitePreview/iframebridge/sendSitePreviewIFrameMessage.js +1 -6
  102. package/lib/style.css +1 -1
  103. package/package.json +16 -9
@@ -1,100 +1 @@
1
- import { readFile } from "fs/promises";
2
- let queryMap;
3
- let fragmentsMap;
4
- async function loadPersistedQueries(path) {
5
- const file = await readFile(path, { encoding: "utf-8" });
6
- queryMap = JSON.parse(file.toString());
7
- fragmentsMap = {};
8
- for (const [, query] of Object.entries(queryMap)) {
9
- const match = query.match(/^\s*fragment\s+(\w+)\s+on\s+\w+/m);
10
- if (match) {
11
- const fragmentName = match[1];
12
- fragmentsMap[fragmentName] = query.replace(/\${.*?}/g, "");
13
- }
14
- }
15
- }
16
- function injectFragments(query) {
17
- query = query.replace(/\${.*?}/g, "");
18
- const injected = /* @__PURE__ */ new Set();
19
- for (const m of query.matchAll(/^\s*fragment\s+(\w+)\s+on\s+\w+/gm)) {
20
- injected.add(m[1]);
21
- }
22
- function inject(q) {
23
- const spreads = Array.from(q.matchAll(/\.\.\.(\w+)/g)).map((m) => m[1]);
24
- let result = q;
25
- for (const fragmentName of spreads) {
26
- if (!injected.has(fragmentName) && fragmentsMap[fragmentName]) {
27
- injected.add(fragmentName);
28
- result += `
29
- ${inject(fragmentsMap[fragmentName])}`;
30
- }
31
- }
32
- return result;
33
- }
34
- query = inject(query);
35
- return query;
36
- }
37
- async function persistedQueryRoute(req, {
38
- graphqlTarget,
39
- headers: headersInit,
40
- persistedQueriesPath = ".persisted-queries.json",
41
- cacheMaxAge
42
- }) {
43
- var _a, _b;
44
- if (!queryMap) {
45
- await loadPersistedQueries(persistedQueriesPath);
46
- }
47
- let hash;
48
- let variables;
49
- if (req.method === "POST") {
50
- const body = await req.json();
51
- hash = (_b = (_a = body.extensions) == null ? void 0 : _a.persistedQuery) == null ? void 0 : _b.sha256Hash;
52
- variables = body.variables;
53
- } else if (req.method === "GET") {
54
- const url = new URL(req.url);
55
- hash = url.searchParams.get("extensions.persistedQuery.sha256Hash");
56
- const variablesParam = url.searchParams.get("variables");
57
- variables = variablesParam ? JSON.parse(variablesParam) : void 0;
58
- } else {
59
- return Response.json({ error: "MethodNotAllowed" }, { status: 405 });
60
- }
61
- if (!hash) {
62
- return Response.json({ error: "OnlyPersistedQueriesAllowed" }, { status: 400 });
63
- }
64
- let query = queryMap[hash];
65
- if (!query) {
66
- return Response.json({ error: "PersistedQueryNotFound", hash }, { status: 400 });
67
- }
68
- query = injectFragments(query);
69
- if (req.method === "GET") {
70
- const apolloPreflight = req.headers.get("Apollo-Require-Preflight");
71
- if (apolloPreflight !== "true") {
72
- return Response.json({ error: "CSRFProtection", message: "Missing Apollo-Require-Preflight header" }, { status: 403 });
73
- }
74
- }
75
- const headers = new Headers(headersInit);
76
- headers.set("Content-Type", "application/json");
77
- for (const header of ["x-include-invisible-content", "x-preview-dam-urls"]) {
78
- const value = req.headers.get(header);
79
- if (value !== null) {
80
- headers.set(header, value);
81
- }
82
- }
83
- const upstreamRes = await fetch(graphqlTarget, {
84
- method: "POST",
85
- headers,
86
- body: JSON.stringify({ query, variables })
87
- });
88
- const responseHeaders = {
89
- "Content-Type": "application/json"
90
- };
91
- if (req.method === "GET" && upstreamRes.ok && cacheMaxAge !== void 0) {
92
- responseHeaders["Cache-Control"] = `public, max-age=${cacheMaxAge}`;
93
- }
94
- return new Response(upstreamRes.body, {
95
- headers: responseHeaders
96
- });
97
- }
98
- export {
99
- persistedQueryRoute
100
- };
1
+ import{readFile as e}from"fs/promises";let s,t;async function r(r,{graphqlTarget:o,headers:n,persistedQueriesPath:a=".persisted-queries.json",cacheMaxAge:i}){let c,l;if(s||await async function(r){const o=await e(r,{encoding:"utf-8"});s=JSON.parse(o.toString()),t={};for(const[,e]of Object.entries(s)){const s=e.match(/^\s*fragment\s+(\w+)\s+on\s+\w+/m);if(s){const r=s[1];t[r]=e.replace(/\${.*?}/g,"")}}}(a),"POST"===r.method){const e=await r.json();c=e.extensions?.persistedQuery?.sha256Hash,l=e.variables}else{if("GET"!==r.method)return Response.json({error:"MethodNotAllowed"},{status:405});{const e=new URL(r.url);c=e.searchParams.get("extensions.persistedQuery.sha256Hash");const s=e.searchParams.get("variables");l=s?JSON.parse(s):void 0}}if(!c)return Response.json({error:"OnlyPersistedQueriesAllowed"},{status:400});let d=s[c];if(!d)return Response.json({error:"PersistedQueryNotFound",hash:c},{status:400});if(d=function(e){e=e.replace(/\${.*?}/g,"");const s=/* @__PURE__ */new Set;for(const t of e.matchAll(/^\s*fragment\s+(\w+)\s+on\s+\w+/gm))s.add(t[1]);return e=function e(r){const o=Array.from(r.matchAll(/\.\.\.(\w+)/g)).map(e=>e[1]);let n=r;for(const a of o)!s.has(a)&&t[a]&&(s.add(a),n+=`\n${e(t[a])}`);return n}(e),e}(d),"GET"===r.method){if("true"!==r.headers.get("Apollo-Require-Preflight"))return Response.json({error:"CSRFProtection",message:"Missing Apollo-Require-Preflight header"},{status:403})}const u=new Headers(n);u.set("Content-Type","application/json");for(const e of["x-include-invisible-content","x-preview-dam-urls"]){const s=r.headers.get(e);null!==s&&u.set(e,s)}const h=await fetch(o,{method:"POST",headers:u,body:JSON.stringify({query:d,variables:l})}),f={"Content-Type":"application/json"};return"GET"===r.method&&h.ok&&void 0!==i&&(f["Cache-Control"]=`public, max-age=${i}`),new Response(h.body,{headers:f})}export{r as persistedQueryRoute};
@@ -1,51 +1 @@
1
- import { createHash } from "crypto";
2
- import * as fs from "fs";
3
- function loadHashMap(path) {
4
- if (fs.existsSync(path)) {
5
- return JSON.parse(fs.readFileSync(path, "utf-8"));
6
- }
7
- return {};
8
- }
9
- function saveHashMap(path, hashMap) {
10
- fs.writeFileSync(path, JSON.stringify(hashMap, null, 2));
11
- }
12
- function hashQuery(query) {
13
- return createHash("sha256").update(query).digest("hex");
14
- }
15
- const gqlTagRegex = /gql`([\s\S]*?)`/gm;
16
- const webpackPersistedQueriesLoader = function(source) {
17
- const options = this.getOptions() || {};
18
- const persistedQueriesPath = options.persistedQueriesPath || ".persisted-queries.json";
19
- const hashMap = loadHashMap(persistedQueriesPath);
20
- const replacements = [];
21
- let match;
22
- while ((match = gqlTagRegex.exec(source)) !== null) {
23
- const query = match[1];
24
- const hash = hashQuery(query);
25
- hashMap[hash] = query;
26
- const fragmentVariables = Array.from(query.matchAll(/\${.*?}/g) ?? []).map((m) => m[0]).join(" ");
27
- if (query.match(/^\s*fragment\s+(\w+)\s+on\s+\w+/)) {
28
- replacements.push({
29
- start: match.index,
30
- end: match.index + match[0].length,
31
- replacement: `{ fragment: true, fragmentVariables: \`${fragmentVariables}\` }`
32
- });
33
- } else {
34
- replacements.push({
35
- start: match.index,
36
- end: match.index + match[0].length,
37
- replacement: `{ hash: "${hash}", fragmentVariables: \`${fragmentVariables}\` }`
38
- });
39
- }
40
- }
41
- let modifiedSource = source;
42
- for (let i = replacements.length - 1; i >= 0; i--) {
43
- const { start, end, replacement } = replacements[i];
44
- modifiedSource = modifiedSource.slice(0, start) + replacement + modifiedSource.slice(end);
45
- }
46
- saveHashMap(persistedQueriesPath, hashMap);
47
- return modifiedSource;
48
- };
49
- export {
50
- webpackPersistedQueriesLoader as default
51
- };
1
+ import{createHash as e}from"crypto";import*as t from"fs";function n(t){return e("sha256").update(t).digest("hex")}const s=/gql`([\s\S]*?)`/gm,r=function(e){const r=(this.getOptions()||{}).persistedQueriesPath||".persisted-queries.json",a=(i=r,t.existsSync(i)?JSON.parse(t.readFileSync(i,"utf-8")):{});var i;const l=[];let o;for(;null!==(o=s.exec(e));){const e=o[1],t=n(e);a[t]=e;const s=Array.from(e.matchAll(/\${.*?}/g)??[]).map(e=>e[0]).join(" ");e.match(/^\s*fragment\s+(\w+)\s+on\s+\w+/)?l.push({start:o.index,end:o.index+o[0].length,replacement:`{ fragment: true, fragmentVariables: \`${s}\` }`}):l.push({start:o.index,end:o.index+o[0].length,replacement:`{ hash: "${t}", fragmentVariables: \`${s}\` }`})}let c=e;for(let t=l.length-1;t>=0;t--){const{start:e,end:n,replacement:s}=l[t];c=c.slice(0,e)+s+c.slice(n)}return function(e,n){t.writeFileSync(e,JSON.stringify(n,null,2))}(r,a),c};export{r as default};
@@ -1 +1 @@
1
- {"version":3,"file":"BlockPreviewProvider.d.ts","sourceRoot":"","sources":["../../src/preview/BlockPreviewProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAmB/C,eAAO,MAAM,oBAAoB,GAAI,cAAc,iBAAiB,4CAcnE,CAAC"}
1
+ {"version":3,"file":"BlockPreviewProvider.d.ts","sourceRoot":"","sources":["../../src/preview/BlockPreviewProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAmB/C,eAAO,MAAM,oBAAoB,GAAI,cAAc,iBAAiB,4CAcnE,CAAC"}
@@ -1,33 +1,2 @@
1
1
  "use client";
2
- import { jsx } from "react/jsx-runtime";
3
- import { useIFrameBridge } from "../iframebridge/useIFrameBridge.js";
4
- import { PreviewContext } from "./PreviewContext.js";
5
- let currentContentScopeJwt = null;
6
- if (typeof window !== "undefined") {
7
- const originalFetch = window.fetch;
8
- window.fetch = async (input, init = {}) => {
9
- const headers = new Headers(init.headers);
10
- const url = new URL(typeof input === "string" ? input : input.toString(), window.location.origin);
11
- if (url.host === window.location.host && currentContentScopeJwt) {
12
- headers.set("X-Block-Preview", currentContentScopeJwt);
13
- }
14
- return originalFetch(input, { ...init, headers });
15
- };
16
- }
17
- const BlockPreviewProvider = ({ children }) => {
18
- const { contentScopeJwt } = useIFrameBridge();
19
- currentContentScopeJwt = contentScopeJwt;
20
- return /* @__PURE__ */ jsx(
21
- PreviewContext.Provider,
22
- {
23
- value: {
24
- previewType: "BlockPreview",
25
- showPreviewSkeletons: true
26
- },
27
- children
28
- }
29
- );
30
- };
31
- export {
32
- BlockPreviewProvider
33
- };
2
+ import{jsx as e}from"react/jsx-runtime";import{useIFrameBridge as o}from"../iframebridge/useIFrameBridge.js";import{PreviewContext as r}from"./PreviewContext.js";let t=null;if("undefined"!=typeof window){const e=window.fetch;window.fetch=async(o,r={})=>{const n=new Headers(r.headers);return new URL("string"==typeof o?o:o.toString(),window.location.origin).host===window.location.host&&t&&n.set("X-Block-Preview",t),e(o,{...r,headers:n})}}const n=({children:n})=>{const{contentScopeJwt:i}=o();return t=i,/* @__PURE__ */e(r.Provider,{value:{previewType:"BlockPreview",showPreviewSkeletons:!0},children:n})};export{n as BlockPreviewProvider};
@@ -1,10 +1,2 @@
1
1
  "use client";
2
- import { createContext } from "react";
3
- const defaultPreviewContextValue = {
4
- previewType: "NoPreview",
5
- showPreviewSkeletons: false
6
- };
7
- const PreviewContext = createContext(defaultPreviewContextValue);
8
- export {
9
- PreviewContext
10
- };
2
+ import{createContext as e}from"react";const o=e({previewType:"NoPreview",showPreviewSkeletons:!1});export{o as PreviewContext};
@@ -1,41 +1 @@
1
- import { useContext, useCallback } from "react";
2
- import { useIFrameBridge } from "../iframebridge/useIFrameBridge.js";
3
- import { PreviewContext } from "./PreviewContext.js";
4
- function usePreview() {
5
- const iFrameBridge = useIFrameBridge();
6
- const previewContext = useContext(PreviewContext);
7
- const isSelected = useCallback(
8
- (url, options) => {
9
- var _a;
10
- if (!iFrameBridge.selectedAdminRoute) {
11
- return false;
12
- }
13
- const exactMatch = (options == null ? void 0 : options.exactMatch) ?? true;
14
- if (exactMatch) {
15
- return url === iFrameBridge.selectedAdminRoute;
16
- } else {
17
- return (_a = iFrameBridge.selectedAdminRoute) == null ? void 0 : _a.startsWith(url);
18
- }
19
- },
20
- [iFrameBridge.selectedAdminRoute]
21
- );
22
- const isHovered = useCallback(
23
- (url, options) => {
24
- var _a;
25
- if (!iFrameBridge.hoveredAdminRoute) {
26
- return false;
27
- }
28
- const exactMatch = (options == null ? void 0 : options.exactMatch) ?? true;
29
- if (exactMatch) {
30
- return url === iFrameBridge.hoveredAdminRoute;
31
- } else {
32
- return (_a = iFrameBridge.hoveredAdminRoute) == null ? void 0 : _a.startsWith(url);
33
- }
34
- },
35
- [iFrameBridge.hoveredAdminRoute]
36
- );
37
- return { ...previewContext, isSelected, isHovered };
38
- }
39
- export {
40
- usePreview
41
- };
1
+ import{useContext as e,useCallback as t}from"react";import{useIFrameBridge as r}from"../iframebridge/useIFrameBridge.js";import{PreviewContext as o}from"./PreviewContext.js";function i(){const i=r();return{...e(o),isSelected:t((e,t)=>{if(!i.selectedAdminRoute)return!1;return t?.exactMatch??!0?e===i.selectedAdminRoute:i.selectedAdminRoute?.startsWith(e)},[i.selectedAdminRoute]),isHovered:t((e,t)=>{if(!i.hoveredAdminRoute)return!1;return t?.exactMatch??!0?e===i.hoveredAdminRoute:i.hoveredAdminRoute?.startsWith(e)},[i.hoveredAdminRoute])}}export{i as usePreview};
@@ -1 +1 @@
1
- {"version":3,"file":"PreviewSkeleton.d.ts","sourceRoot":"","sources":["../../src/previewskeleton/PreviewSkeleton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAK/D,UAAU,aAAc,SAAQ,iBAAiB;IAC7C,IAAI,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,QAAA,MAAM,eAAe,GAAI,0HAWtB,aAAa,mDA+Cf,CAAC;AAsBF,OAAO,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"PreviewSkeleton.d.ts","sourceRoot":"","sources":["../../src/previewskeleton/PreviewSkeleton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAK1D,UAAU,aAAc,SAAQ,iBAAiB;IAC7C,IAAI,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,QAAA,MAAM,eAAe,GAAI,0HAWtB,aAAa,mDA+Cf,CAAC;AAsBF,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -1,65 +1,9 @@
1
1
  "use client";
2
- import { jsx, Fragment, jsxs } from "react/jsx-runtime";
3
- import { usePreview } from "../preview/usePreview.js";
4
- import styles from "./PreviewSkeleton.module.scss.js";
5
- const PreviewSkeleton = ({
6
- children,
7
- customContainer,
8
- title,
9
- type = "bar",
10
- aspectRatio,
11
- height: passedHeight,
12
- hasContent,
13
- color = "#A8A7A8",
14
- backgroundColor = type === "media" ? "#efefef" : "#E0DDE0",
15
- fill = false
16
- }) => {
17
- const preview = usePreview();
18
- const validAspectRatio = getValidAspectRatio(aspectRatio);
19
- if (preview.showPreviewSkeletons && !hasContent) {
20
- if (customContainer) {
21
- return /* @__PURE__ */ jsx(Fragment, { children: customContainer });
22
- } else if (type === "bar") {
23
- return /* @__PURE__ */ jsx("div", { className: styles.barSkeleton, style: { "--background-color": backgroundColor, "--color": color }, children: title });
24
- } else if (type === "rows") {
25
- return /* @__PURE__ */ jsxs("div", { className: styles.rowsContainer, children: [
26
- /* @__PURE__ */ jsx("div", { className: styles.rowSkeleton, style: { "--width": "75%", "--background-color": backgroundColor, "--color": color }, children: title }),
27
- /* @__PURE__ */ jsx("div", { className: styles.rowSkeleton, style: { "--width": "100%", "--background-color": backgroundColor, "--color": color } }),
28
- /* @__PURE__ */ jsx("div", { className: styles.rowSkeleton, style: { "--width": "50%", "--background-color": backgroundColor, "--color": color } })
29
- ] });
30
- } else if (type === "media") {
31
- const height = fill ? "100%" : passedHeight ?? 300;
32
- return /* @__PURE__ */ jsx(
33
- "div",
34
- {
35
- className: styles.imageContainer,
36
- style: {
37
- "--background-color": backgroundColor,
38
- "--color": color,
39
- ...validAspectRatio === void 0 || fill ? { "--height": typeof height === "string" ? height : `${height}px` } : { "--aspect-ratio": validAspectRatio }
40
- },
41
- children: title
42
- }
43
- );
44
- }
45
- }
46
- if (!hasContent) {
47
- return null;
48
- }
49
- return /* @__PURE__ */ jsx(Fragment, { children });
50
- };
51
- const getValidAspectRatio = (aspectRatio) => {
52
- if (aspectRatio === "inherit") {
53
- return void 0;
54
- }
55
- if (aspectRatio === "auto") {
56
- return void 0;
57
- }
58
- if (typeof aspectRatio === "string") {
59
- return aspectRatio.replace("x", "/");
60
- }
61
- return aspectRatio;
62
- };
63
- export {
64
- PreviewSkeleton
65
- };
2
+ import{jsx as e,Fragment as r,jsxs as o}from"react/jsx-runtime";import{usePreview as t}from"../preview/usePreview.js";import i from"./PreviewSkeleton.module.scss.js";const l=({children:l,customContainer:c,title:s,type:a="bar",aspectRatio:d,height:m,hasContent:u,color:h="#A8A7A8",backgroundColor:f=("media"===a?"#efefef":"#E0DDE0"),fill:w=!1})=>{const k=t(),p=n(d);if(k.showPreviewSkeletons&&!u){if(c)/* @__PURE__ */
3
+ return e(r,{children:c});if("bar"===a)/* @__PURE__ */
4
+ return e("div",{className:i.barSkeleton,style:{"--background-color":f,"--color":h},children:s});if("rows"===a)/* @__PURE__ */
5
+ return o("div",{className:i.rowsContainer,children:[
6
+ /* @__PURE__ */e("div",{className:i.rowSkeleton,style:{"--width":"75%","--background-color":f,"--color":h},children:s}),
7
+ /* @__PURE__ */e("div",{className:i.rowSkeleton,style:{"--width":"100%","--background-color":f,"--color":h}}),
8
+ /* @__PURE__ */e("div",{className:i.rowSkeleton,style:{"--width":"50%","--background-color":f,"--color":h}})]});if("media"===a){const r=w?"100%":m??300;/* @__PURE__ */
9
+ return e("div",{className:i.imageContainer,style:{"--background-color":f,"--color":h,...void 0===p||w?{"--height":"string"==typeof r?r:`${r}px`}:{"--aspect-ratio":p}},children:s})}}return u?/* @__PURE__ */e(r,{children:l}):null},n=e=>{if("inherit"!==e&&"auto"!==e)return"string"==typeof e?e.replace("x","/"):e};export{l as PreviewSkeleton};
@@ -1,17 +1 @@
1
- const barSkeleton = "_barSkeleton_zomv4_1";
2
- const rowsContainer = "_rowsContainer_zomv4_9";
3
- const rowSkeleton = "_rowSkeleton_zomv4_14";
4
- const imageContainer = "_imageContainer_zomv4_22";
5
- const styles = {
6
- barSkeleton,
7
- rowsContainer,
8
- rowSkeleton,
9
- imageContainer
10
- };
11
- export {
12
- barSkeleton,
13
- styles as default,
14
- imageContainer,
15
- rowSkeleton,
16
- rowsContainer
17
- };
1
+ const o="_barSkeleton_zomv4_1",e="_rowsContainer_zomv4_9",n="_rowSkeleton_zomv4_14",_="_imageContainer_zomv4_22",r={barSkeleton:o,rowsContainer:e,rowSkeleton:n,imageContainer:_};export{o as barSkeleton,r as default,_ as imageContainer,n as rowSkeleton,e as rowsContainer};
@@ -0,0 +1,2 @@
1
+ export { persistedQueryRoute } from './persistedQueries/persistedQueryRoute';
2
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC"}
package/lib/server.js ADDED
@@ -0,0 +1 @@
1
+ import{persistedQueryRoute as e}from"./persistedQueries/persistedQueryRoute.js";export{e as persistedQueryRoute};
@@ -1 +1 @@
1
- {"version":3,"file":"SitePreviewIFrameMessage.d.ts","sourceRoot":"","sources":["../../../src/sitePreview/iframebridge/SitePreviewIFrameMessage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAIpE,oBAAY,4BAA4B;IACpC,QAAQ,aAAa;IACrB,mBAAmB,wBAAwB;CAC9C;AAED,UAAU,gCAAgC;IACtC,SAAS,EAAE,4BAA4B,CAAC,QAAQ,CAAC;IACjD,IAAI,EAAE;QACF,IAAI,EAAE,qBAAqB,CAAC;KAC/B,CAAC;CACL;AAED,MAAM,WAAW,gCAAgC;IAC7C,SAAS,EAAE,4BAA4B,CAAC,mBAAmB,CAAC;IAC5D,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,GAAG,UAAU,CAAC,CAAC;CAC/C;AAED,MAAM,MAAM,wBAAwB,GAAG,gCAAgC,GAAG,gCAAgC,CAAC"}
1
+ {"version":3,"file":"SitePreviewIFrameMessage.d.ts","sourceRoot":"","sources":["../../../src/sitePreview/iframebridge/SitePreviewIFrameMessage.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAIpE,oBAAY,4BAA4B;IACpC,QAAQ,aAAa;IACrB,mBAAmB,wBAAwB;CAC9C;AAED,UAAU,gCAAgC;IACtC,SAAS,EAAE,4BAA4B,CAAC,QAAQ,CAAC;IACjD,IAAI,EAAE;QACF,IAAI,EAAE,qBAAqB,CAAC;KAC/B,CAAC;CACL;AAED,MAAM,WAAW,gCAAgC;IAC7C,SAAS,EAAE,4BAA4B,CAAC,mBAAmB,CAAC;IAC5D,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,GAAG,UAAU,CAAC,CAAC;CAC/C;AAED,MAAM,MAAM,wBAAwB,GAAG,gCAAgC,GAAG,gCAAgC,CAAC"}
@@ -1,8 +1 @@
1
- var SitePreviewIFrameMessageType = /* @__PURE__ */ ((SitePreviewIFrameMessageType2) => {
2
- SitePreviewIFrameMessageType2["OpenLink"] = "OpenLink";
3
- SitePreviewIFrameMessageType2["SitePreviewLocation"] = "SitePreviewLocation";
4
- return SitePreviewIFrameMessageType2;
5
- })(SitePreviewIFrameMessageType || {});
6
- export {
7
- SitePreviewIFrameMessageType
8
- };
1
+ var e=/* @__PURE__ */(e=>(e.OpenLink="OpenLink",e.SitePreviewLocation="SitePreviewLocation",e))(e||{});export{e as SitePreviewIFrameMessageType};
@@ -1 +1 @@
1
- {"version":3,"file":"sendSitePreviewIFrameMessage.d.ts","sourceRoot":"","sources":["../../../src/sitePreview/iframebridge/sendSitePreviewIFrameMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAE3E,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,wBAAwB,QAE7E"}
1
+ {"version":3,"file":"sendSitePreviewIFrameMessage.d.ts","sourceRoot":"","sources":["../../../src/sitePreview/iframebridge/sendSitePreviewIFrameMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAE3E,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,wBAAwB,QAE7E"}
@@ -1,6 +1 @@
1
- function sendSitePreviewIFrameMessage(message) {
2
- window.parent.postMessage(JSON.stringify(message), "*");
3
- }
4
- export {
5
- sendSitePreviewIFrameMessage
6
- };
1
+ function n(n){window.parent.postMessage(JSON.stringify(n),"*")}export{n as sendSitePreviewIFrameMessage};
package/lib/style.css CHANGED
@@ -1 +1 @@
1
- ._previewElementContainer_nwhl6_1{display:contents}._childrenWrapper_qguhx_1{position:relative;z-index:1}._root_v4248_1{position:absolute;z-index:2;top:0;left:0;right:0;min-height:100vh;height:var(--height)}._root_1ya0k_1{position:absolute;cursor:pointer;outline:1px solid transparent;outline-offset:-1px}._root_1ya0k_1:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;opacity:.25}._root_1ya0k_1:hover{outline-color:#29b6f6;outline-style:solid}._root_1ya0k_1:hover:after{background-color:#29b6f6}._isHoveredInBlockList_1ya0k_24{outline-color:#29b6f6;outline-style:solid}._isHoveredInBlockList_1ya0k_24:after{background-color:#29b6f6}._showBlockOutlines_1ya0k_32:not(:hover){outline-color:#d9d9d9;outline-style:dashed}._blockIsSelected_1ya0k_37{outline-color:#29b6f6}._blockIsSelected_1ya0k_37 ._label_1ya0k_40{display:inline-block}._label_1ya0k_40{position:absolute;padding:2px;background-color:#57b0eb;line-height:16px;color:#fff;top:1px;right:1px;font-size:12px;display:none}._barSkeleton_zomv4_1{min-height:20px;margin-bottom:5px;margin-right:5px;background-color:var(--background-color);color:var(--color)}._rowsContainer_zomv4_9{width:100%;min-width:300px}._rowSkeleton_zomv4_14{margin-bottom:10px;min-height:20px;width:var(--width);background-color:var(--background-color);color:var(--color)}._imageContainer_zomv4_22{width:100%;aspect-ratio:var(--aspect-ratio);height:var(--height);background-color:var(--background-color);color:var(--color)}._root_1jlho_1{position:relative;height:100%}._video_1jlho_6{width:100%;object-fit:cover;aspect-ratio:var(--aspect-ratio)}._fill_1jlho_12{height:100%}._button_4r8gs_1{position:absolute;left:8px;bottom:8px;width:24px;height:24px;display:flex;align-items:center;justify-content:center;background-color:#000000b3;z-index:10}._button_4r8gs_1:hover,._button_4r8gs_1:active{background-color:#9e9e9e}._button_4r8gs_1:focus{border-radius:6px}._animatedPlayPause_4r8gs_23{box-sizing:border-box;height:12px;border-color:transparent transparent transparent #fff;cursor:pointer;border-style:solid;border-width:6px 0 6px 9px;transition:border-width .1s ease,border-style .1s ease}._animatedPlayPausePaused_4r8gs_32{border-style:double;border-width:0 0 0 9px}._root_1k5a5_1{position:relative;width:100%}._fill_1k5a5_6{height:100%}._iconWrapper_1k5a5_10{position:absolute;top:0;right:0;left:0;bottom:0;display:flex;align-items:center;justify-content:center;background-color:#000;opacity:.5;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;padding:0;cursor:pointer}._iconWrapper_1k5a5_10:focus ._playIcon_1k5a5_26{outline:4px solid white;outline-offset:10px;border-radius:2px}._playIcon_1k5a5_26{width:64px;height:64px;box-sizing:border-box;border-style:solid;border-width:32px 0 32px 64px;border-color:transparent transparent transparent white}._videoContainer_1flq1_1{overflow:hidden;position:relative;aspect-ratio:var(--aspect-ratio)}._fill_1flq1_7{width:100%;height:100%}._vimeoContainer_1flq1_12{position:absolute;border:0;top:0;left:0;width:100%;height:100%}._videoContainer_bhmhr_1{overflow:hidden;position:relative;aspect-ratio:var(--aspect-ratio)}._fill_bhmhr_7{width:100%;height:100%}._youtubeContainer_bhmhr_12{position:absolute;border:0;top:0;left:0;width:100%;height:100%}
1
+ ._previewElementContainer_nwhl6_1{display:contents}._childrenWrapper_qguhx_1{position:relative;z-index:1}._root_v4248_1{position:absolute;z-index:2;top:0;left:0;right:0;min-height:100vh;height:var(--height)}._root_1ya0k_1{position:absolute;cursor:pointer;outline:1px solid transparent;outline-offset:-1px}._root_1ya0k_1:after{content:"";position:absolute;inset:0;opacity:.25}._root_1ya0k_1:hover{outline-color:#29b6f6;outline-style:solid}._root_1ya0k_1:hover:after{background-color:#29b6f6}._isHoveredInBlockList_1ya0k_24{outline-color:#29b6f6;outline-style:solid}._isHoveredInBlockList_1ya0k_24:after{background-color:#29b6f6}._showBlockOutlines_1ya0k_32:not(:hover){outline-color:#d9d9d9;outline-style:dashed}._blockIsSelected_1ya0k_37{outline-color:#29b6f6}._blockIsSelected_1ya0k_37 ._label_1ya0k_40{display:inline-block}._label_1ya0k_40{position:absolute;padding:2px;background-color:#57b0eb;line-height:16px;color:#fff;top:1px;right:1px;font-size:12px;display:none}._barSkeleton_zomv4_1{min-height:20px;margin-bottom:5px;margin-right:5px;background-color:var(--background-color);color:var(--color)}._rowsContainer_zomv4_9{width:100%;min-width:300px}._rowSkeleton_zomv4_14{margin-bottom:10px;min-height:20px;width:var(--width);background-color:var(--background-color);color:var(--color)}._imageContainer_zomv4_22{width:100%;aspect-ratio:var(--aspect-ratio);height:var(--height);background-color:var(--background-color);color:var(--color)}._root_1jlho_1{position:relative;height:100%}._video_1jlho_6{width:100%;object-fit:cover;aspect-ratio:var(--aspect-ratio)}._fill_1jlho_12{height:100%}._button_4r8gs_1{position:absolute;left:8px;bottom:8px;width:24px;height:24px;display:flex;align-items:center;justify-content:center;background-color:#000000b3;z-index:10}._button_4r8gs_1:hover,._button_4r8gs_1:active{background-color:#9e9e9e}._button_4r8gs_1:focus{border-radius:6px}._animatedPlayPause_4r8gs_23{box-sizing:border-box;height:12px;border-color:transparent transparent transparent #fff;cursor:pointer;border-style:solid;border-width:6px 0 6px 9px;transition:border-width .1s ease,border-style .1s ease}._animatedPlayPausePaused_4r8gs_32{border-style:double;border-width:0 0 0 9px}._root_1k5a5_1{position:relative;width:100%}._fill_1k5a5_6{height:100%}._iconWrapper_1k5a5_10{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background-color:#000;opacity:.5;appearance:none;border:none;padding:0;cursor:pointer}._iconWrapper_1k5a5_10:focus ._playIcon_1k5a5_26{outline:4px solid white;outline-offset:10px;border-radius:2px}._playIcon_1k5a5_26{width:64px;height:64px;box-sizing:border-box;border-style:solid;border-width:32px 0 32px 64px;border-color:transparent transparent transparent white}._videoContainer_1flq1_1{overflow:hidden;position:relative;aspect-ratio:var(--aspect-ratio)}._fill_1flq1_7{width:100%;height:100%}._vimeoContainer_1flq1_12{position:absolute;border:0;top:0;left:0;width:100%;height:100%}._videoContainer_bhmhr_1{overflow:hidden;position:relative;aspect-ratio:var(--aspect-ratio)}._fill_bhmhr_7{width:100%;height:100%}._youtubeContainer_bhmhr_12{position:absolute;border:0;top:0;left:0;width:100%;height:100%}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comet/site-react",
3
- "version": "9.0.0-beta.2",
3
+ "version": "9.0.0-beta.4",
4
4
  "description": "Comet Site React package",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,6 +18,10 @@
18
18
  "import": "./lib/index.js"
19
19
  },
20
20
  "./css": "./lib/style.css",
21
+ "./server": {
22
+ "types": "./lib/server.d.ts",
23
+ "import": "./lib/server.js"
24
+ },
21
25
  "./webpackPersistedQueriesLoader": "./lib/persistedQueries/webpackPersistedQueriesLoader.js"
22
26
  },
23
27
  "files": [
@@ -33,25 +37,28 @@
33
37
  "devDependencies": {
34
38
  "@types/draft-js": "^0.11.20",
35
39
  "@types/lodash.isequal": "^4.5.8",
36
- "@types/react": "^19.2.10",
40
+ "@types/react": "^19.2.14",
41
+ "@types/react-dom": "^19.2.3",
37
42
  "@vitejs/plugin-react": "^4.7.0",
38
43
  "chokidar-cli": "^3.0.0",
39
- "eslint": "^9.39.2",
40
- "jsdom": "^28.0.0",
44
+ "eslint": "^9.39.4",
45
+ "jsdom": "^28.1.0",
41
46
  "npm-run-all2": "^8.0.4",
42
47
  "prettier": "^3.6.2",
43
- "react": "^19.2.4",
48
+ "react": "^19.2.6",
49
+ "react-dom": "^19.2.6",
44
50
  "rimraf": "^6.1.2",
45
51
  "rollup": "^4.44.2",
46
52
  "rollup-plugin-preserve-directives": "^0.4.0",
47
53
  "sass": "^1.89.2",
54
+ "schema-dts": "^2.0.0",
48
55
  "typescript": "^5.9.3",
49
- "vite": "^5.4.21",
56
+ "vite": "^7.2.4",
50
57
  "vite-plugin-dts": "^4.5.4",
51
58
  "vitest": "^4.0.16",
52
- "webpack": "^5.102.1",
53
- "@comet/cli": "9.0.0-beta.2",
54
- "@comet/eslint-config": "9.0.0-beta.2"
59
+ "webpack": "^5.106.2",
60
+ "@comet/cli": "9.0.0-beta.4",
61
+ "@comet/eslint-config": "9.0.0-beta.4"
55
62
  },
56
63
  "peerDependencies": {
57
64
  "react": "^18.0.0 || ^19.0.0"