@dextinity/site-react 2.0.0-canary-20260729062014
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/LICENSE +24 -0
- package/lib/aiContentDisclosure/AiContentDisclosure.d.ts +33 -0
- package/lib/aiContentDisclosure/AiContentDisclosure.d.ts.map +1 -0
- package/lib/aiContentDisclosure/AiContentDisclosure.js +2 -0
- package/lib/aiContentDisclosure/AiContentDisclosure.module.scss.js +1 -0
- package/lib/aiContentDisclosure/getAiContentAltTextWithPrefix.d.ts +23 -0
- package/lib/aiContentDisclosure/getAiContentAltTextWithPrefix.d.ts.map +1 -0
- package/lib/aiContentDisclosure/getAiContentAltTextWithPrefix.js +1 -0
- package/lib/aiContentDisclosure/icons/AiGeneratedBlackIcon.d.ts +3 -0
- package/lib/aiContentDisclosure/icons/AiGeneratedBlackIcon.d.ts.map +1 -0
- package/lib/aiContentDisclosure/icons/AiGeneratedBlackIcon.js +15 -0
- package/lib/aiContentDisclosure/icons/AiGeneratedWhiteIcon.d.ts +3 -0
- package/lib/aiContentDisclosure/icons/AiGeneratedWhiteIcon.d.ts.map +1 -0
- package/lib/aiContentDisclosure/icons/AiGeneratedWhiteIcon.js +15 -0
- package/lib/aiContentDisclosure/icons/AiModifiedBlackIcon.d.ts +3 -0
- package/lib/aiContentDisclosure/icons/AiModifiedBlackIcon.d.ts.map +1 -0
- package/lib/aiContentDisclosure/icons/AiModifiedBlackIcon.js +14 -0
- package/lib/aiContentDisclosure/icons/AiModifiedWhiteIcon.d.ts +3 -0
- package/lib/aiContentDisclosure/icons/AiModifiedWhiteIcon.d.ts.map +1 -0
- package/lib/aiContentDisclosure/icons/AiModifiedWhiteIcon.js +14 -0
- package/lib/blockLoader/blockLoader.d.ts +34 -0
- package/lib/blockLoader/blockLoader.d.ts.map +1 -0
- package/lib/blockLoader/blockLoader.js +1 -0
- package/lib/blocks/DamFileDownloadLinkBlock.d.ts +10 -0
- package/lib/blocks/DamFileDownloadLinkBlock.d.ts.map +1 -0
- package/lib/blocks/DamFileDownloadLinkBlock.js +2 -0
- package/lib/blocks/DamVideoBlock.d.ts +26 -0
- package/lib/blocks/DamVideoBlock.d.ts.map +1 -0
- package/lib/blocks/DamVideoBlock.js +6 -0
- package/lib/blocks/DamVideoBlock.module.scss.js +1 -0
- package/lib/blocks/EmailLinkBlock.d.ts +10 -0
- package/lib/blocks/EmailLinkBlock.d.ts.map +1 -0
- package/lib/blocks/EmailLinkBlock.js +1 -0
- package/lib/blocks/ExternalLinkBlock.d.ts +10 -0
- package/lib/blocks/ExternalLinkBlock.d.ts.map +1 -0
- package/lib/blocks/ExternalLinkBlock.js +2 -0
- package/lib/blocks/PhoneLinkBlock.d.ts +10 -0
- package/lib/blocks/PhoneLinkBlock.d.ts.map +1 -0
- package/lib/blocks/PhoneLinkBlock.js +1 -0
- package/lib/blocks/PropsWithData.d.ts +4 -0
- package/lib/blocks/PropsWithData.d.ts.map +1 -0
- package/lib/blocks/SvgImageBlock.d.ts +10 -0
- package/lib/blocks/SvgImageBlock.d.ts.map +1 -0
- package/lib/blocks/SvgImageBlock.js +2 -0
- package/lib/blocks/VimeoVideoBlock.d.ts +18 -0
- package/lib/blocks/VimeoVideoBlock.d.ts.map +1 -0
- package/lib/blocks/VimeoVideoBlock.js +5 -0
- package/lib/blocks/VimeoVideoBlock.module.scss.js +1 -0
- package/lib/blocks/YouTubeVideoBlock.d.ts +18 -0
- package/lib/blocks/YouTubeVideoBlock.d.ts.map +1 -0
- package/lib/blocks/YouTubeVideoBlock.js +5 -0
- package/lib/blocks/YouTubeVideoBlock.module.scss.js +1 -0
- package/lib/blocks/factories/BlocksBlock.d.ts +15 -0
- package/lib/blocks/factories/BlocksBlock.d.ts.map +1 -0
- package/lib/blocks/factories/BlocksBlock.js +1 -0
- package/lib/blocks/factories/ListBlock.d.ts +14 -0
- package/lib/blocks/factories/ListBlock.d.ts.map +1 -0
- package/lib/blocks/factories/ListBlock.js +1 -0
- package/lib/blocks/factories/OneOfBlock.d.ts +15 -0
- package/lib/blocks/factories/OneOfBlock.d.ts.map +1 -0
- package/lib/blocks/factories/OneOfBlock.js +1 -0
- package/lib/blocks/factories/OptionalBlock.d.ts +11 -0
- package/lib/blocks/factories/OptionalBlock.d.ts.map +1 -0
- package/lib/blocks/factories/OptionalBlock.js +1 -0
- package/lib/blocks/factories/types.d.ts +5 -0
- package/lib/blocks/factories/types.d.ts.map +1 -0
- package/lib/blocks/helpers/PlayPauseButton.d.ts +8 -0
- package/lib/blocks/helpers/PlayPauseButton.d.ts.map +1 -0
- package/lib/blocks/helpers/PlayPauseButton.js +1 -0
- package/lib/blocks/helpers/PlayPauseButton.module.scss.js +1 -0
- package/lib/blocks/helpers/RichTextBlockHelper.d.ts +3 -0
- package/lib/blocks/helpers/RichTextBlockHelper.d.ts.map +1 -0
- package/lib/blocks/helpers/RichTextBlockHelper.js +1 -0
- 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 +21 -0
- package/lib/blocks/helpers/VideoPreviewImage.d.ts.map +1 -0
- package/lib/blocks/helpers/VideoPreviewImage.js +2 -0
- package/lib/blocks/helpers/VideoPreviewImage.module.scss.js +1 -0
- package/lib/blocks/helpers/useIsElementInViewport.d.ts +3 -0
- package/lib/blocks/helpers/useIsElementInViewport.d.ts.map +1 -0
- package/lib/blocks/helpers/useIsElementInViewport.js +2 -0
- package/lib/blocks.generated.d.ts +200 -0
- package/lib/blocks.generated.d.ts.map +1 -0
- package/lib/cookies/CookieApiContext.d.ts +14 -0
- package/lib/cookies/CookieApiContext.d.ts.map +1 -0
- package/lib/cookies/CookieApiContext.js +3 -0
- package/lib/cookies/CookieSafe.d.ts +9 -0
- package/lib/cookies/CookieSafe.d.ts.map +1 -0
- package/lib/cookies/CookieSafe.js +3 -0
- package/lib/cookies/useCookieBotCookieApi.d.ts +3 -0
- package/lib/cookies/useCookieBotCookieApi.d.ts.map +1 -0
- package/lib/cookies/useCookieBotCookieApi.js +2 -0
- package/lib/cookies/useLocalStorageCookieApi.d.ts +11 -0
- package/lib/cookies/useLocalStorageCookieApi.d.ts.map +1 -0
- package/lib/cookies/useLocalStorageCookieApi.js +2 -0
- package/lib/cookies/useOneTrustCookieApi.d.ts +3 -0
- package/lib/cookies/useOneTrustCookieApi.d.ts.map +1 -0
- package/lib/cookies/useOneTrustCookieApi.js +2 -0
- package/lib/errorHandler/ErrorHandlerBoundary.d.ts +3 -0
- package/lib/errorHandler/ErrorHandlerBoundary.d.ts.map +1 -0
- package/lib/errorHandler/ErrorHandlerBoundary.js +2 -0
- package/lib/errorHandler/ErrorHandlerBoundaryInternal.d.ts +17 -0
- package/lib/errorHandler/ErrorHandlerBoundaryInternal.d.ts.map +1 -0
- package/lib/errorHandler/ErrorHandlerBoundaryInternal.js +2 -0
- package/lib/errorHandler/ErrorHandlerProvider.d.ts +8 -0
- package/lib/errorHandler/ErrorHandlerProvider.d.ts.map +1 -0
- package/lib/errorHandler/ErrorHandlerProvider.js +3 -0
- package/lib/graphQLFetch/fetchInMemoryCache.d.ts +4 -0
- package/lib/graphQLFetch/fetchInMemoryCache.d.ts.map +1 -0
- package/lib/graphQLFetch/fetchInMemoryCache.js +1 -0
- package/lib/graphQLFetch/graphQLFetch.d.ts +12 -0
- package/lib/graphQLFetch/graphQLFetch.d.ts.map +1 -0
- package/lib/graphQLFetch/graphQLFetch.js +1 -0
- package/lib/iframebridge/IFrameBridge.d.ts +42 -0
- package/lib/iframebridge/IFrameBridge.d.ts.map +1 -0
- package/lib/iframebridge/IFrameBridge.js +5 -0
- package/lib/iframebridge/IFrameBridge.module.scss.js +1 -0
- package/lib/iframebridge/IFrameMessage.d.ts +122 -0
- package/lib/iframebridge/IFrameMessage.d.ts.map +1 -0
- package/lib/iframebridge/IFrameMessage.js +1 -0
- package/lib/iframebridge/Preview.d.ts +9 -0
- package/lib/iframebridge/Preview.d.ts.map +1 -0
- package/lib/iframebridge/Preview.js +2 -0
- package/lib/iframebridge/Preview.module.scss.js +1 -0
- package/lib/iframebridge/PreviewOverlay.d.ts +2 -0
- package/lib/iframebridge/PreviewOverlay.d.ts.map +1 -0
- package/lib/iframebridge/PreviewOverlay.js +1 -0
- package/lib/iframebridge/PreviewOverlay.module.scss.js +1 -0
- package/lib/iframebridge/PreviewOverlayElement.d.ts +7 -0
- package/lib/iframebridge/PreviewOverlayElement.d.ts.map +1 -0
- package/lib/iframebridge/PreviewOverlayElement.js +2 -0
- package/lib/iframebridge/PreviewOverlayElement.module.scss.js +1 -0
- package/lib/iframebridge/useBlockPreviewFetch.d.ts +16 -0
- package/lib/iframebridge/useBlockPreviewFetch.d.ts.map +1 -0
- package/lib/iframebridge/useBlockPreviewFetch.js +2 -0
- package/lib/iframebridge/useIFrameBridge.d.ts +3 -0
- package/lib/iframebridge/useIFrameBridge.d.ts.map +1 -0
- package/lib/iframebridge/useIFrameBridge.js +1 -0
- package/lib/iframebridge/utils.d.ts +10 -0
- package/lib/iframebridge/utils.d.ts.map +1 -0
- package/lib/iframebridge/utils.js +1 -0
- package/lib/iframebridge/withPreview.d.ts +18 -0
- package/lib/iframebridge/withPreview.d.ts.map +1 -0
- package/lib/iframebridge/withPreview.js +2 -0
- package/lib/image/Image.d.ts +9 -0
- package/lib/image/Image.d.ts.map +1 -0
- package/lib/image/Image.js +2 -0
- package/lib/image/image.utils.d.ts +18 -0
- package/lib/image/image.utils.d.ts.map +1 -0
- package/lib/image/image.utils.js +1 -0
- package/lib/index.d.ts +49 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +1 -0
- 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 +5 -0
- package/lib/persistedQueries/createPersistedQueryGraphQLFetch.d.ts.map +1 -0
- package/lib/persistedQueries/createPersistedQueryGraphQLFetch.js +1 -0
- package/lib/persistedQueries/persistedQueryRoute.d.ts +7 -0
- package/lib/persistedQueries/persistedQueryRoute.d.ts.map +1 -0
- package/lib/persistedQueries/persistedQueryRoute.js +1 -0
- package/lib/persistedQueries/webpackPersistedQueriesLoader.d.ts +7 -0
- package/lib/persistedQueries/webpackPersistedQueriesLoader.d.ts.map +1 -0
- package/lib/persistedQueries/webpackPersistedQueriesLoader.js +1 -0
- package/lib/preview/BlockPreviewProvider.d.ts +3 -0
- package/lib/preview/BlockPreviewProvider.d.ts.map +1 -0
- package/lib/preview/BlockPreviewProvider.js +2 -0
- package/lib/preview/PreviewContext.d.ts +6 -0
- package/lib/preview/PreviewContext.d.ts.map +1 -0
- package/lib/preview/PreviewContext.js +2 -0
- package/lib/preview/usePreview.d.ts +12 -0
- package/lib/preview/usePreview.d.ts.map +1 -0
- package/lib/preview/usePreview.js +1 -0
- package/lib/previewskeleton/PreviewSkeleton.d.ts +15 -0
- package/lib/previewskeleton/PreviewSkeleton.d.ts.map +1 -0
- package/lib/previewskeleton/PreviewSkeleton.js +9 -0
- package/lib/previewskeleton/PreviewSkeleton.module.scss.js +1 -0
- 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 +18 -0
- package/lib/sitePreview/iframebridge/SitePreviewIFrameMessage.d.ts.map +1 -0
- package/lib/sitePreview/iframebridge/SitePreviewIFrameMessage.js +1 -0
- package/lib/sitePreview/iframebridge/sendSitePreviewIFrameMessage.d.ts +3 -0
- package/lib/sitePreview/iframebridge/sendSitePreviewIFrameMessage.d.ts.map +1 -0
- package/lib/sitePreview/iframebridge/sendSitePreviewIFrameMessage.js +1 -0
- package/lib/style.css +1 -0
- package/package.json +91 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { IFrameMessage } from './IFrameMessage';
|
|
3
|
+
type PreviewElement = {
|
|
4
|
+
element: HTMLElement;
|
|
5
|
+
adminRoute: string;
|
|
6
|
+
label: string;
|
|
7
|
+
};
|
|
8
|
+
export type OverlayElementData = {
|
|
9
|
+
adminRoute: string;
|
|
10
|
+
label: string;
|
|
11
|
+
position: {
|
|
12
|
+
zIndex: number;
|
|
13
|
+
top: number;
|
|
14
|
+
left: number;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export interface IFrameBridgeContext {
|
|
20
|
+
hasBridge: boolean;
|
|
21
|
+
block?: any;
|
|
22
|
+
showOnlyVisible: boolean;
|
|
23
|
+
selectedAdminRoute?: string;
|
|
24
|
+
hoveredAdminRoute?: string | null;
|
|
25
|
+
sendSelectComponent: (id: string) => void;
|
|
26
|
+
sendHoverComponent: (route: string | null) => void;
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Use sendSitePreviewIFrameMessage instead
|
|
29
|
+
*/
|
|
30
|
+
sendMessage: (message: IFrameMessage) => void;
|
|
31
|
+
showOutlines: boolean;
|
|
32
|
+
contentScope: unknown;
|
|
33
|
+
contentScopeJwt: string;
|
|
34
|
+
graphQLApiUrl: string | undefined;
|
|
35
|
+
previewElementsData: OverlayElementData[];
|
|
36
|
+
addPreviewElement: (element: PreviewElement) => void;
|
|
37
|
+
removePreviewElement: (element: PreviewElement) => void;
|
|
38
|
+
}
|
|
39
|
+
export declare const IFrameBridgeContext: import('react').Context<IFrameBridgeContext>;
|
|
40
|
+
export declare const IFrameBridgeProvider: ({ children }: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=IFrameBridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IFrameBridge.d.ts","sourceRoot":"","sources":["../../src/iframebridge/IFrameBridge.tsx"],"names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,EAAE,cAAc,KAAK,IAAI,CAAC;CAC3D;AAED,eAAO,MAAM,mBAAmB,8CAuB9B,CAAC;AAYH,eAAO,MAAM,oBAAoB,GAAI,cAAc,iBAAiB,4CA4PnE,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{decodeJwt as o}from"jose";import n from"lodash.isequal";import{useState as r,useRef as i,useCallback as s,useEffect as a,useMemo as d,createContext as c}from"react";import{useDebounceCallback as l}from"usehooks-ts";import m from"./IFrameBridge.module.scss.js";import{AdminMessageType as p,IFrameMessageType as h}from"./IFrameMessage.js";import{PreviewOverlay as u}from"./PreviewOverlay.js";import{getRecursiveChildrenOfPreviewElement as v,getCombinedPositioningOfElements as w,PREVIEW_ELEMENT_SCROLLED_INTO_VIEW_EVENT as f}from"./utils.js";const b=c({hasBridge:!1,showOutlines:!1,showOnlyVisible:!1,sendSelectComponent:()=>{},sendHoverComponent:()=>{},sendMessage:()=>{},contentScope:void 0,contentScopeJwt:"",graphQLApiUrl:void 0,previewElementsData:[],removePreviewElement:()=>{},addPreviewElement:()=>{}});const g=({children:c})=>{const[g,y]=r(void 0),[R,O]=r(!1),[S,E]=r(void 0),[k,C]=r(null),[L,J]=r(!1),[M,P]=r(void 0),[j,A]=r(""),[T,x]=r(""),[I,B]=r([]),[H,Q]=r([]),U=i(null),V=U.current?.offsetWidth,F=s(()=>{if(!V)return;const e=I.map(e=>{const t=v(e.element),o=w(t);if(o.left>V)return{adminRoute:e.adminRoute,label:e.label,position:{top:o.top,left:o.left,width:0,height:o.height}};const n=o.left+o.width-V,r=n>0?n:0;return{adminRoute:e.adminRoute,label:e.label,position:{top:o.top,left:o.left,width:o.width-r,height:o.height}}}).filter(e=>0!==e.position.width).sort((e,t)=>{const o=e.position.width*e.position.height;return t.position.width*t.position.height-o}).map((e,t)=>({...e,position:{...e.position,zIndex:t+1}}));Q(t=>n(t,e)?t:e)},[I,V]);a(()=>{if(U.current){const e=new MutationObserver(()=>{F()}),t=new ResizeObserver(()=>{F()});return e.observe(U.current,{childList:!0,subtree:!0,attributes:!0}),t.observe(U.current),()=>{e.disconnect(),t.disconnect()}}},[F]),a(()=>(I.forEach(e=>{e.element.addEventListener(f,F)}),()=>{I.forEach(e=>{e.element.removeEventListener(f,F)})}),[I,F]);const N=s(e=>{window.parent.postMessage(JSON.stringify(e),"*")},[]),W=l(()=>{J(!1)},2500),z=s(e=>{switch(e.cometType){case p.Block:y(e.data.block);break;case p.ShowOnlyVisible:O(e.data.showOnlyVisible);break;case p.SelectComponent:E(e.data.adminRoute.lastIndexOf("#")>0?e.data.adminRoute.substr(0,e.data.adminRoute.lastIndexOf("#")):e.data.adminRoute);break;case p.HoverComponent:C(e.data.adminRoute),J(!0),W();break;case p.ContentScope:P(function(e){try{return o(e).scope}catch(t){return void console.error("Failed to parse content scope JWT",t)}}(e.data.contentScopeJwt)),A(e.data.contentScopeJwt);break;case p.GraphQLApiUrl:x(e.data.graphQLApiUrl)}},[W]);a(()=>{if("undefined"==typeof window)return;const e=e=>{try{const t=JSON.parse(e.data);t.hasOwnProperty("cometType")&&z(t)}catch{}};return window.addEventListener("message",e,!1),N({cometType:h.Ready}),()=>{window.removeEventListener("message",e,!1)}},[z,N]);const D=s(e=>{B(t=>[...t,e])},[B]),q=s(e=>{B(t=>t.filter(t=>t.adminRoute!==e.adminRoute))},[B]),G=d(()=>({showOutlines:L,hasBridge:!0,block:g,showOnlyVisible:R,selectedAdminRoute:S,hoveredAdminRoute:k,sendSelectComponent:e=>{E(e),N({cometType:h.SelectComponent,data:{adminRoute:e}})},sendHoverComponent:e=>{N({cometType:h.HoverComponent,data:{route:e}})},sendMessage:N,contentScope:M,contentScopeJwt:j,graphQLApiUrl:T,previewElementsData:H,addPreviewElement:D,removePreviewElement:q}),[L,g,R,S,k,N,M,j,T,H,D,q]);/* @__PURE__ */
|
|
3
|
+
return e(b.Provider,{value:G,children:/* @__PURE__ */t("div",{onMouseMove:()=>{J(!0),W()},children:[
|
|
4
|
+
/* @__PURE__ */e(u,{}),
|
|
5
|
+
/* @__PURE__ */e("div",{ref:U,className:m.childrenWrapper,children:c})]})})};export{b as IFrameBridgeContext,g as IFrameBridgeProvider};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const r="_childrenWrapper_qguhx_1",e={childrenWrapper:r};export{r as childrenWrapper,e as default};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { ExternalLinkBlockData } from '../blocks.generated';
|
|
2
|
+
export declare enum IFrameMessageType {
|
|
3
|
+
Ready = "Ready",
|
|
4
|
+
SelectComponent = "SelectComponent",
|
|
5
|
+
HoverComponent = "HoverComponent",
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use SitePreviewIFrameMessageType.OpenLink instead
|
|
8
|
+
*/
|
|
9
|
+
OpenLink = "OpenLink",
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Use SitePreviewIFrameMessageType.SitePreviewLocation instead
|
|
12
|
+
*/
|
|
13
|
+
SitePreviewLocation = "SitePreviewLocation"
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The `IReadyIFrameMessage` message is sent from the site to the admin when the iFrame is ready to receive messages.
|
|
17
|
+
*/
|
|
18
|
+
export interface IReadyIFrameMessage {
|
|
19
|
+
cometType: IFrameMessageType.Ready;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The `IFrameSelectComponentMessage` is sent from the site to the admin when a component is selected in the iFrame.
|
|
23
|
+
*
|
|
24
|
+
* The admin interface will then try to navigate to the corresponding block's admin interface.
|
|
25
|
+
*/
|
|
26
|
+
export interface IFrameSelectComponentMessage {
|
|
27
|
+
cometType: IFrameMessageType.SelectComponent;
|
|
28
|
+
data: {
|
|
29
|
+
adminRoute: string;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Use SitePreviewIFrameOpenLinkMessage instead
|
|
34
|
+
*/
|
|
35
|
+
export interface IFrameOpenLinkMessage {
|
|
36
|
+
cometType: IFrameMessageType.OpenLink;
|
|
37
|
+
data: {
|
|
38
|
+
link: ExternalLinkBlockData;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated Use SitePreviewIFrameLocationMessage instead
|
|
43
|
+
*/
|
|
44
|
+
export interface IFrameLocationMessage {
|
|
45
|
+
cometType: IFrameMessageType.SitePreviewLocation;
|
|
46
|
+
data: Pick<Location, "search" | "pathname">;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The `IFrameHoverComponentMessage` is sent from the site to the admin, when a component is hovered in the iFrame and should be highlighted in the admin interface.
|
|
50
|
+
*/
|
|
51
|
+
export interface IFrameHoverComponentMessage {
|
|
52
|
+
cometType: IFrameMessageType.HoverComponent;
|
|
53
|
+
data: {
|
|
54
|
+
route: string | null;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export type IFrameMessage = IReadyIFrameMessage | IFrameSelectComponentMessage | IFrameOpenLinkMessage | IFrameLocationMessage | IFrameHoverComponentMessage;
|
|
58
|
+
export declare enum AdminMessageType {
|
|
59
|
+
Block = "Block",
|
|
60
|
+
ShowOnlyVisible = "ShowOnlyVisible",
|
|
61
|
+
SelectComponent = "SelectComponent",
|
|
62
|
+
HoverComponent = "HoverComponent",
|
|
63
|
+
ContentScope = "ContentScope",
|
|
64
|
+
GraphQLApiUrl = "GraphQLApiUrl"
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The `IAdminBlockMessage` is sent from the admin to the site, whih block should be displayed in the iFrame.
|
|
68
|
+
*/
|
|
69
|
+
interface IAdminBlockMessage {
|
|
70
|
+
cometType: AdminMessageType.Block;
|
|
71
|
+
data: {
|
|
72
|
+
block: unknown;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The `IAdminShowOnlyVisibleMessage` is sent from the admin to the site, when the "Show only visible" checkbox is toggled.
|
|
77
|
+
*/
|
|
78
|
+
export interface IAdminShowOnlyVisibleMessage {
|
|
79
|
+
cometType: AdminMessageType.ShowOnlyVisible;
|
|
80
|
+
data: {
|
|
81
|
+
showOnlyVisible: boolean;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The `IAdminSelectComponentMessage` is sent from the admin to the site, when a component is selected in the admin interface.
|
|
86
|
+
*/
|
|
87
|
+
interface IAdminSelectComponentMessage {
|
|
88
|
+
cometType: AdminMessageType.SelectComponent;
|
|
89
|
+
data: {
|
|
90
|
+
adminRoute: string;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The `IAdminHoverComponentMessage` is sent from the admin to the site, when a component is hovered in the admin interface.
|
|
95
|
+
*/
|
|
96
|
+
export interface IAdminHoverComponentMessage {
|
|
97
|
+
cometType: AdminMessageType.HoverComponent;
|
|
98
|
+
data: {
|
|
99
|
+
adminRoute: string | null;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The `IAdminContentScopeMessage` is sent from the admin to the site, when the content scope is changed in the admin interface.
|
|
104
|
+
*/
|
|
105
|
+
export interface IAdminContentScopeMessage {
|
|
106
|
+
cometType: AdminMessageType.ContentScope;
|
|
107
|
+
data: {
|
|
108
|
+
contentScopeJwt: string;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* The `IAdminGraphQLApiUrlMessage` is sent from the admin to the site.
|
|
113
|
+
*/
|
|
114
|
+
export interface IAdminGraphQLApiUrlMessage {
|
|
115
|
+
cometType: AdminMessageType.GraphQLApiUrl;
|
|
116
|
+
data: {
|
|
117
|
+
graphQLApiUrl: string;
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
export type AdminMessage = IAdminBlockMessage | IAdminSelectComponentMessage | IAdminHoverComponentMessage | IAdminContentScopeMessage | IAdminShowOnlyVisibleMessage | IAdminGraphQLApiUrlMessage;
|
|
121
|
+
export {};
|
|
122
|
+
//# sourceMappingURL=IFrameMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IFrameMessage.d.ts","sourceRoot":"","sources":["../../src/iframebridge/IFrameMessage.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAEjE,oBAAY,iBAAiB;IACzB,KAAK,UAAU;IACf,eAAe,oBAAoB;IACnC,cAAc,mBAAmB;IACjC;;OAEG;IACH,QAAQ,aAAa;IACrB;;OAEG;IACH,mBAAmB,wBAAwB;CAC9C;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,SAAS,EAAE,iBAAiB,CAAC,KAAK,CAAC;CACtC;AAED;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IACzC,SAAS,EAAE,iBAAiB,CAAC,eAAe,CAAC;IAC7C,IAAI,EAAE;QACF,UAAU,EAAE,MAAM,CAAC;KACtB,CAAC;CACL;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC,SAAS,EAAE,iBAAiB,CAAC,QAAQ,CAAC;IACtC,IAAI,EAAE;QACF,IAAI,EAAE,qBAAqB,CAAC;KAC/B,CAAC;CACL;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC,SAAS,EAAE,iBAAiB,CAAC,mBAAmB,CAAC;IACjD,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,GAAG,UAAU,CAAC,CAAC;CAC/C;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IACxC,SAAS,EAAE,iBAAiB,CAAC,cAAc,CAAC;IAC5C,IAAI,EAAE;QACF,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;KACxB,CAAC;CACL;AAED,MAAM,MAAM,aAAa,GACnB,mBAAmB,GACnB,4BAA4B,GAC5B,qBAAqB,GACrB,qBAAqB,GACrB,2BAA2B,CAAC;AAGlC,oBA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.HoverComponent="HoverComponent",e.OpenLink="OpenLink",e.SitePreviewLocation="SitePreviewLocation",e))(e||{}),o=/* @__PURE__ */(e=>(e.Block="Block",e.ShowOnlyVisible="ShowOnlyVisible",e.SelectComponent="SelectComponent",e.HoverComponent="HoverComponent",e.ContentScope="ContentScope",e.GraphQLApiUrl="GraphQLApiUrl",e))(o||{});export{o as AdminMessageType,e as IFrameMessageType};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
interface Props extends PropsWithChildren {
|
|
3
|
+
adminRoute: string;
|
|
4
|
+
label: string;
|
|
5
|
+
enabledAutoScrolling?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const Preview: ({ adminRoute, children, label, enabledAutoScrolling }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=Preview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Preview.d.ts","sourceRoot":"","sources":["../../src/iframebridge/Preview.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,iBAAiB,EAAqB,MAAM,OAAO,CAAC;AAOlE,UAAU,KAAM,SAAQ,iBAAiB;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,eAAO,MAAM,OAAO,GAAI,uDAA8D,KAAK,4CAyD1F,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e,Fragment as r}from"react/jsx-runtime";import{useRef as t,useEffect as n}from"react";import i from"scroll-into-view-if-needed";import o from"./Preview.module.scss.js";import{useIFrameBridge as l}from"./useIFrameBridge.js";import{PREVIEW_ELEMENT_SCROLLED_INTO_VIEW_EVENT as m,BLOCK_PREVIEW_CONTAINER_DATA_ATTRIBUTE as s}from"./utils.js";const c=({adminRoute:c,children:d,label:u,enabledAutoScrolling:a=!0})=>{const{addPreviewElement:f,removePreviewElement:v,...h}=l(),p=c===h.selectedAdminRoute,E=c===h.hoveredAdminRoute,w=t(null);return n(()=>{const e=w.current?{label:u,adminRoute:c,element:w.current}:null;if(e)return f(e),()=>{v(e)}},[u,c,f,v]),n(()=>{const e=setTimeout(()=>{a&&(E||p)&&w.current?.firstElementChild&&(i(w.current.firstElementChild,{scrollMode:"if-needed",block:"center",inline:"nearest",behavior:"smooth"}),setTimeout(()=>{w.current?.dispatchEvent(new Event(m))},600))},500);return()=>{clearTimeout(e)}},[a,E,p]),h.hasBridge?/* @__PURE__ */e("div",{ref:w,className:o.previewElementContainer,[s]:"",children:d}):/* @__PURE__ */e(r,{children:d})};export{c as Preview};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e="_previewElementContainer_nwhl6_1",n={previewElementContainer:e};export{n as default,e as previewElementContainer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreviewOverlay.d.ts","sourceRoot":"","sources":["../../src/iframebridge/PreviewOverlay.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,+CA6B1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import t from"./PreviewOverlay.module.scss.js";import{PreviewOverlayElement as o}from"./PreviewOverlayElement.js";import{useIFrameBridge as r}from"./useIFrameBridge.js";let i="";const m=()=>{const m=r();let s=0;return m.previewElementsData.forEach(e=>{if(e.position.zIndex>1)return;const t=e.position.top+e.position.height;t>s&&(s=t)}),/* @__PURE__ */e("div",{className:t.root,style:{"--height":`${s}px`},children:m.previewElementsData.map((t,r)=>(t.adminRoute===m.selectedAdminRoute&&i!==t.adminRoute&&(i=t.adminRoute),/* @__PURE__ */e(o,{element:t},r)))})};export{m as PreviewOverlay};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o="_root_v4248_1",t={root:o};export{t as default,o as root};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OverlayElementData } from './IFrameBridge';
|
|
2
|
+
type Props = {
|
|
3
|
+
element: OverlayElementData;
|
|
4
|
+
};
|
|
5
|
+
export declare const PreviewOverlayElement: ({ element }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=PreviewOverlayElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreviewOverlayElement.d.ts","sourceRoot":"","sources":["../../src/iframebridge/PreviewOverlayElement.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAIzD,KAAK,KAAK,GAAG;IACT,OAAO,EAAE,kBAAkB,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,aAAa,KAAK,4CA8BvD,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import o from"clsx";import t from"./PreviewOverlayElement.module.scss.js";import{useIFrameBridge as n}from"./useIFrameBridge.js";const s=({element:s})=>{const l=n(),i=s.adminRoute===l.selectedAdminRoute,m=s.adminRoute===l.hoveredAdminRoute;/* @__PURE__ */
|
|
2
|
+
return e("div",{className:o(t.root,l.showOutlines&&!m&&t.showBlockOutlines,i&&t.blockIsSelected,m&&t.isHoveredInBlockList),title:s.label,onClick:()=>{l.sendSelectComponent(s.adminRoute)},onMouseEnter:()=>{l.sendHoverComponent(s.adminRoute)},onMouseLeave:()=>{l.sendHoverComponent(null)},style:s.position,children:/* @__PURE__ */e("div",{className:t.label,children:s.label})},s.adminRoute)};export{s as PreviewOverlayElement};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e="_root_1ya0k_1",o="_isHoveredInBlockList_1ya0k_24",l="_showBlockOutlines_1ya0k_32",_="_blockIsSelected_1ya0k_37",s="_label_1ya0k_40",k={root:e,isHoveredInBlockList:o,showBlockOutlines:l,blockIsSelected:_,label:s};export{_ as blockIsSelected,k as default,o as isHoveredInBlockList,s as label,e as root,l as showBlockOutlines};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { GraphQLFetch } from '../graphQLFetch/graphQLFetch';
|
|
2
|
+
type Fetch = typeof fetch;
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use useBlockPreviewFetch() without argument instead
|
|
5
|
+
* @param apiUrl the API URL
|
|
6
|
+
*/
|
|
7
|
+
export declare function useBlockPreviewFetch(apiUrl: string): {
|
|
8
|
+
fetch: Fetch;
|
|
9
|
+
graphQLFetch: GraphQLFetch;
|
|
10
|
+
};
|
|
11
|
+
export declare function useBlockPreviewFetch(apiUrl?: string | undefined): {
|
|
12
|
+
fetch: Fetch;
|
|
13
|
+
graphQLFetch?: GraphQLFetch;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=useBlockPreviewFetch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBlockPreviewFetch.d.ts","sourceRoot":"","sources":["../../src/iframebridge/useBlockPreviewFetch.tsx"],"names":[],"mappings":"AAKA,OAAO,EAA4E,KAAK,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAK3I,KAAK,KAAK,GAAG,OAAO,KAAK,CAAC;AAE1B;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,YAAY,EAAE,YAAY,CAAA;CAAE,CAAC;AACnG,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,YAAY,CAAC,EAAE,YAAY,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{useState as r,useEffect as e}from"react";import{createFetchInMemoryCache as t}from"../graphQLFetch/fetchInMemoryCache.js";import{createGraphQLFetch as c,createFetchWithDefaults as i,convertPreviewDataToHeaders as o}from"../graphQLFetch/graphQLFetch.js";import{useIFrameBridge as h}from"./useIFrameBridge.js";const n=t(fetch);function p(t){const{showOnlyVisible:c,graphQLApiUrl:i}=h(),[o,p]=r(()=>t?s(t,!c):void 0);return e(()=>{i&&p(()=>s(i,!c))},[c,i]),{graphQLFetch:o,fetch:n}}function s(r,e){return c(i(n,{headers:o({includeInvisible:e}),credentials:"include"}),r)}export{p as useBlockPreviewFetch};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIFrameBridge.d.ts","sourceRoot":"","sources":["../../src/iframebridge/useIFrameBridge.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,wBAAgB,eAAe,IAAI,mBAAmB,CAErD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useContext as r}from"react";import{IFrameBridgeContext as o}from"./IFrameBridge.js";function t(){return r(o)}export{t as useIFrameBridge};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const BLOCK_PREVIEW_CONTAINER_DATA_ATTRIBUTE = "data-comet-block-preview-container";
|
|
2
|
+
export declare const PREVIEW_ELEMENT_SCROLLED_INTO_VIEW_EVENT = "comet-preview-element-scrolled-into-view";
|
|
3
|
+
export declare const getRecursiveChildrenOfPreviewElement: (rootElement: Element) => Element[];
|
|
4
|
+
export declare const getCombinedPositioningOfElements: (elements: Element[]) => {
|
|
5
|
+
top: number;
|
|
6
|
+
left: number;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/iframebridge/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sCAAsC,uCAAuC,CAAC;AAC3F,eAAO,MAAM,wCAAwC,6CAA6C,CAAC;AAEnG,eAAO,MAAM,oCAAoC,GAAI,aAAa,OAAO,KAAG,OAAO,EAgBlF,CAAC;AAEF,eAAO,MAAM,gCAAgC,GAAI,UAAU,OAAO,EAAE;;;;;CAgCnE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t="data-comet-block-preview-container",o="comet-preview-element-scrolled-into-view",e=o=>{const n=[];return o.childNodes.forEach(o=>{o instanceof Element&&(o.hasAttribute(t)?n.push(...e(o)):n.push(o))}),n},n=t=>{const o=[],e=[];t.forEach(t=>{const{top:n,left:c,bottom:i,right:h}=t.getBoundingClientRect();o.push(n+window.scrollY),e.push(c+window.scrollX)});const n=Math.min(...o),c=Math.min(...e),i=[],h=[];return t.forEach(t=>{const{right:o,bottom:e}=t.getBoundingClientRect();i.push(o-c),h.push(e-n+window.scrollY)}),{top:n,left:c,width:Math.max(...i),height:Math.max(...h)}};export{t as BLOCK_PREVIEW_CONTAINER_DATA_ATTRIBUTE,o as PREVIEW_ELEMENT_SCROLLED_INTO_VIEW_EVENT,n as getCombinedPositioningOfElements,e as getRecursiveChildrenOfPreviewElement};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
interface AdminMetaInterface {
|
|
3
|
+
route: string;
|
|
4
|
+
}
|
|
5
|
+
export interface WithPreviewProps {
|
|
6
|
+
data: WithPreviewPropsData;
|
|
7
|
+
}
|
|
8
|
+
interface WithPreviewPropsData {
|
|
9
|
+
adminMeta?: AdminMetaInterface;
|
|
10
|
+
}
|
|
11
|
+
export declare function isWithPreviewPropsData(block: unknown): block is WithPreviewPropsData;
|
|
12
|
+
interface PreviewOptions {
|
|
13
|
+
label?: string;
|
|
14
|
+
enabledChildrenAutoScrolling?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare const withPreview: <ComponentProps>(Component: ComponentType<ComponentProps>, { label, enabledChildrenAutoScrolling }: PreviewOptions) => ({ ...componentProps }: WithPreviewProps & ComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=withPreview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withPreview.d.ts","sourceRoot":"","sources":["../../src/iframebridge/withPreview.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAA6B,MAAM,OAAO,CAAC;AAItE,UAAU,kBAAkB;IACxB,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,oBAAoB,CAAC;CAC9B;AAED,UAAU,oBAAoB;IAC1B,SAAS,CAAC,EAAE,kBAAkB,CAAC;CAClC;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,oBAAoB,CAEpF;AAED,UAAU,cAAc;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4BAA4B,CAAC,EAAE,OAAO,CAAC;CAC1C;AAWD,eAAO,MAAM,WAAW,GAAI,cAAc,EACtC,WAAW,aAAa,CAAC,cAAc,CAAC,EACxC,yCAA4D,cAAc,MAElE,uBAAuB,gBAAgB,GAAG,cAAc,4CAoBnE,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e}from"react/jsx-runtime";import{useContext as t,createContext as a}from"react";import{Preview as r}from"./Preview.js";function n(e){return void 0!==e.adminMeta}const o=a({parentRoute:"",parentEnabledAutoScrolling:!0}),l=(a,{label:n="No type",enabledChildrenAutoScrolling:l=!0})=>({...i})=>{const{parentRoute:d,parentEnabledAutoScrolling:u}=t(o);return i.data?.adminMeta&&i.data?.adminMeta.route!==d?/* @__PURE__ */e(o.Provider,{value:{parentRoute:i.data?.adminMeta.route,parentEnabledAutoScrolling:!!u&&l},children:/* @__PURE__ */e(r,{adminRoute:i.data?.adminMeta.route,label:n,enabledAutoScrolling:u,children:/* @__PURE__ */e(a,{...i})})}):/* @__PURE__ */e(a,{...i})};export{n as isWithPreviewPropsData,l as withPreview};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ImgHTMLAttributes } from 'react';
|
|
2
|
+
type ImageProps = ImgHTMLAttributes<HTMLImageElement> & {
|
|
3
|
+
aspectRatio: string | number;
|
|
4
|
+
src: string;
|
|
5
|
+
width: string | number;
|
|
6
|
+
};
|
|
7
|
+
export declare function Image({ aspectRatio, src, width, ...imgProps }: ImageProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=Image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../src/image/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAI/C,KAAK,UAAU,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,GAAG;IAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAE9H,wBAAgB,KAAK,CAAC,EAAE,WAAW,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,EAAE,UAAU,2CAKzE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare function parseAspectRatio(value: string | number): number;
|
|
2
|
+
export interface ImageDimensions {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function getMaxDimensionsFromArea(area: ImageDimensions, aspectRatio: number): ImageDimensions;
|
|
7
|
+
export declare function calculateInheritAspectRatio(imageDimensions: ImageDimensions, cropArea: {
|
|
8
|
+
focalPoint: "SMART" | "CENTER" | "NORTHWEST" | "NORTHEAST" | "SOUTHWEST" | "SOUTHEAST";
|
|
9
|
+
width?: number;
|
|
10
|
+
height?: number;
|
|
11
|
+
x?: number;
|
|
12
|
+
y?: number;
|
|
13
|
+
}): number;
|
|
14
|
+
export declare function generateImageUrl({ src, width }: {
|
|
15
|
+
src: string;
|
|
16
|
+
width: number;
|
|
17
|
+
}, aspectRatio: number): string;
|
|
18
|
+
//# sourceMappingURL=image.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.utils.d.ts","sourceRoot":"","sources":["../../src/image/image.utils.ts"],"names":[],"mappings":"AACA,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAsB/D;AAGD,MAAM,WAAW,eAAe;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAClB;AAGD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,GAAG,eAAe,CAcpG;AAGD,wBAAgB,2BAA2B,CACvC,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE;IACN,UAAU,EAAE,OAAO,GAAG,QAAQ,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,CAAC;IACvF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;CACd,GACF,MAAM,CAUR;AAED,wBAAgB,gBAAgB,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAE5G"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(t){let i,r;if("string"==typeof t?([i,r]=t.split(/[x/:]/).map(t=>{let i=parseFloat(t);return isNaN(i)&&(i=void 0),i}),i&&!r&&(r=1)):(i=t,r=1),!i||!r)throw Error(`An error occurred while parsing the aspect ratio: ${t}`);return i/r}function i(t,i){let r,e;return i<1?(r=Math.min(t.height*i,t.width),e=r/i):(e=Math.min(t.width/i,t.height),r=e*i),{width:r,height:e}}function r(t,i){if("SMART"===i.focalPoint)return t.width/t.height;if(void 0===i.width||void 0===i.height)throw new Error("Missing crop dimensions");return i.width*t.width/100/(i.height*t.height/100)}function e({src:t,width:i},r){return t.replace("$resizeWidth",String(i)).replace("$resizeHeight",String(Math.ceil(i/r)))}export{r as calculateInheritAspectRatio,e as generateImageUrl,i as getMaxDimensionsFromArea,t as parseAspectRatio};
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export { AiContentDisclosure, type AiContentDisclosureProps, type AiContentType } from './aiContentDisclosure/AiContentDisclosure';
|
|
2
|
+
export { type AiContentAltTextPrefixLabels, getAiContentAltTextWithPrefix } from './aiContentDisclosure/getAiContentAltTextWithPrefix';
|
|
3
|
+
export { type BlockLoader, type BlockLoaderDependencies, type BlockLoaderOptions, recursivelyLoadBlockData } from './blockLoader/blockLoader';
|
|
4
|
+
export { DamFileDownloadLinkBlock } from './blocks/DamFileDownloadLinkBlock';
|
|
5
|
+
export { DamVideoBlock } from './blocks/DamVideoBlock';
|
|
6
|
+
export { EmailLinkBlock } from './blocks/EmailLinkBlock';
|
|
7
|
+
export { ExternalLinkBlock } from './blocks/ExternalLinkBlock';
|
|
8
|
+
export { BlocksBlock } from './blocks/factories/BlocksBlock';
|
|
9
|
+
export { ListBlock } from './blocks/factories/ListBlock';
|
|
10
|
+
export { OneOfBlock } from './blocks/factories/OneOfBlock';
|
|
11
|
+
export { OptionalBlock } from './blocks/factories/OptionalBlock';
|
|
12
|
+
export type { SupportedBlocks } from './blocks/factories/types';
|
|
13
|
+
export { type PlayPauseButtonProps } from './blocks/helpers/PlayPauseButton';
|
|
14
|
+
export { hasRichTextBlockContent } from './blocks/helpers/RichTextBlockHelper';
|
|
15
|
+
export { hasTipTapRichTextContent, renderTipTapRichText, type RenderTipTapRichTextOptions, type TipTapMark, type TipTapMarkHandler, type TipTapMarkHandlerProps, type TipTapNode, type TipTapNodeHandler, type TipTapNodeHandlerProps, } from './blocks/helpers/TipTapRichTextRenderer';
|
|
16
|
+
export { useIsElementInViewport } from './blocks/helpers/useIsElementInViewport';
|
|
17
|
+
export type { VideoPreviewImageProps } from './blocks/helpers/VideoPreviewImage';
|
|
18
|
+
export { VideoPreviewImage } from './blocks/helpers/VideoPreviewImage';
|
|
19
|
+
export { PhoneLinkBlock } from './blocks/PhoneLinkBlock';
|
|
20
|
+
export type { PropsWithData } from './blocks/PropsWithData';
|
|
21
|
+
export { SvgImageBlock } from './blocks/SvgImageBlock';
|
|
22
|
+
export { VimeoVideoBlock } from './blocks/VimeoVideoBlock';
|
|
23
|
+
export { YouTubeVideoBlock } from './blocks/YouTubeVideoBlock';
|
|
24
|
+
export { type CookieApi, CookieApiProvider, useCookieApi } from './cookies/CookieApiContext';
|
|
25
|
+
export { CookieSafe } from './cookies/CookieSafe';
|
|
26
|
+
export { useCookieBotCookieApi } from './cookies/useCookieBotCookieApi';
|
|
27
|
+
export { useLocalStorageCookieApi } from './cookies/useLocalStorageCookieApi';
|
|
28
|
+
export { useOneTrustCookieApi } from './cookies/useOneTrustCookieApi';
|
|
29
|
+
export { ErrorHandlerBoundary } from './errorHandler/ErrorHandlerBoundary';
|
|
30
|
+
export { ErrorHandlerProvider } from './errorHandler/ErrorHandlerProvider';
|
|
31
|
+
export { createFetchInMemoryCache } from './graphQLFetch/fetchInMemoryCache';
|
|
32
|
+
export { convertPreviewDataToHeaders, createFetchWithDefaults, createFetchWithPreviewHeaders, createGraphQLFetch, gql, type GraphQLFetch, type PreviewData, } from './graphQLFetch/graphQLFetch';
|
|
33
|
+
export { IFrameBridgeProvider } from './iframebridge/IFrameBridge';
|
|
34
|
+
export { AdminMessageType, type IAdminContentScopeMessage, type IAdminGraphQLApiUrlMessage, type IAdminHoverComponentMessage, type IAdminShowOnlyVisibleMessage, type IFrameHoverComponentMessage, type IFrameLocationMessage, type IFrameMessage, IFrameMessageType, type IFrameOpenLinkMessage, type IFrameSelectComponentMessage, type IReadyIFrameMessage, } from './iframebridge/IFrameMessage';
|
|
35
|
+
export { Preview } from './iframebridge/Preview';
|
|
36
|
+
export { useBlockPreviewFetch } from './iframebridge/useBlockPreviewFetch';
|
|
37
|
+
export { useIFrameBridge } from './iframebridge/useIFrameBridge';
|
|
38
|
+
export { isWithPreviewPropsData, withPreview, type WithPreviewProps } from './iframebridge/withPreview';
|
|
39
|
+
export { Image } from './image/Image';
|
|
40
|
+
export { calculateInheritAspectRatio, generateImageUrl, getMaxDimensionsFromArea, type ImageDimensions, parseAspectRatio } from './image/image.utils';
|
|
41
|
+
export { JsonLd, type JsonLdProps } from './jsonLd/JsonLd';
|
|
42
|
+
export { createPersistedQueryGraphQLFetch } from './persistedQueries/createPersistedQueryGraphQLFetch';
|
|
43
|
+
export { BlockPreviewProvider } from './preview/BlockPreviewProvider';
|
|
44
|
+
export { PreviewContext } from './preview/PreviewContext';
|
|
45
|
+
export { usePreview } from './preview/usePreview';
|
|
46
|
+
export { PreviewSkeleton } from './previewskeleton/PreviewSkeleton';
|
|
47
|
+
export { sendSitePreviewIFrameMessage } from './sitePreview/iframebridge/sendSitePreviewIFrameMessage';
|
|
48
|
+
export { type SitePreviewIFrameLocationMessage, SitePreviewIFrameMessageType } from './sitePreview/iframebridge/SitePreviewIFrameMessage';
|
|
49
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,KAAK,wBAAwB,EAAE,KAAK,aAAa,EAAE,MAAM,2CAA2C,CAAC;AACnI,OAAO,EAAE,KAAK,4BAA4B,EAAE,6BAA6B,EAAE,MAAM,qDAAqD,CAAC;AACvI,OAAO,EAAE,KAAK,WAAW,EAAE,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,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,KAAK,eAAe,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACtJ,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,gCAAgC,EAAE,MAAM,qDAAqD,CAAC;AACvG,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,yDAAyD,CAAC;AACvG,OAAO,EAAE,KAAK,gCAAgC,EAAE,4BAA4B,EAAE,MAAM,qDAAqD,CAAC"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{AiContentDisclosure as o}from"./aiContentDisclosure/AiContentDisclosure.js";import{getAiContentAltTextWithPrefix as r}from"./aiContentDisclosure/getAiContentAltTextWithPrefix.js";import{recursivelyLoadBlockData as e}from"./blockLoader/blockLoader.js";import{DamFileDownloadLinkBlock as i}from"./blocks/DamFileDownloadLinkBlock.js";import{DamVideoBlock as m}from"./blocks/DamVideoBlock.js";import{EmailLinkBlock as s}from"./blocks/EmailLinkBlock.js";import{ExternalLinkBlock as t}from"./blocks/ExternalLinkBlock.js";import{BlocksBlock as p}from"./blocks/factories/BlocksBlock.js";import{ListBlock as f}from"./blocks/factories/ListBlock.js";import{OneOfBlock as c}from"./blocks/factories/OneOfBlock.js";import{OptionalBlock as l}from"./blocks/factories/OptionalBlock.js";import{hasRichTextBlockContent as a}from"./blocks/helpers/RichTextBlockHelper.js";import{hasTipTapRichTextContent as k,renderTipTapRichText as j}from"./blocks/helpers/TipTapRichTextRenderer.js";import{useIsElementInViewport as n}from"./blocks/helpers/useIsElementInViewport.js";import{VideoPreviewImage as d}from"./blocks/helpers/VideoPreviewImage.js";import{PhoneLinkBlock as b}from"./blocks/PhoneLinkBlock.js";import{SvgImageBlock as g}from"./blocks/SvgImageBlock.js";import{VimeoVideoBlock as h}from"./blocks/VimeoVideoBlock.js";import{YouTubeVideoBlock as B}from"./blocks/YouTubeVideoBlock.js";import{CookieApiProvider as v,useCookieApi as w}from"./cookies/CookieApiContext.js";import{CookieSafe as u}from"./cookies/CookieSafe.js";import{useCookieBotCookieApi as P}from"./cookies/useCookieBotCookieApi.js";import{useLocalStorageCookieApi as L}from"./cookies/useLocalStorageCookieApi.js";import{useOneTrustCookieApi as C}from"./cookies/useOneTrustCookieApi.js";import{ErrorHandlerBoundary as F}from"./errorHandler/ErrorHandlerBoundary.js";import{ErrorHandlerProvider as I}from"./errorHandler/ErrorHandlerProvider.js";import{createFetchInMemoryCache as x}from"./graphQLFetch/fetchInMemoryCache.js";import{convertPreviewDataToHeaders as A,createFetchWithDefaults as T,createFetchWithPreviewHeaders as D,createGraphQLFetch as Q,gql as S}from"./graphQLFetch/graphQLFetch.js";import{IFrameBridgeProvider as V}from"./iframebridge/IFrameBridge.js";import{AdminMessageType as E,IFrameMessageType as H}from"./iframebridge/IFrameMessage.js";import{Preview as M}from"./iframebridge/Preview.js";import{useBlockPreviewFetch as O}from"./iframebridge/useBlockPreviewFetch.js";import{useIFrameBridge as y}from"./iframebridge/useIFrameBridge.js";import{isWithPreviewPropsData as R,withPreview as G}from"./iframebridge/withPreview.js";import{Image as J}from"./image/Image.js";import{calculateInheritAspectRatio as W,generateImageUrl as Y,getMaxDimensionsFromArea as q,parseAspectRatio as z}from"./image/image.utils.js";import{JsonLd as K}from"./jsonLd/JsonLd.js";import{createPersistedQueryGraphQLFetch as N}from"./persistedQueries/createPersistedQueryGraphQLFetch.js";import{BlockPreviewProvider as U}from"./preview/BlockPreviewProvider.js";import{PreviewContext as X}from"./preview/PreviewContext.js";import{usePreview as Z}from"./preview/usePreview.js";import{PreviewSkeleton as $}from"./previewskeleton/PreviewSkeleton.js";import{sendSitePreviewIFrameMessage as _}from"./sitePreview/iframebridge/sendSitePreviewIFrameMessage.js";import{SitePreviewIFrameMessageType as oo}from"./sitePreview/iframebridge/SitePreviewIFrameMessage.js";export{E as AdminMessageType,o as AiContentDisclosure,U as BlockPreviewProvider,p as BlocksBlock,v as CookieApiProvider,u as CookieSafe,i as DamFileDownloadLinkBlock,m as DamVideoBlock,s as EmailLinkBlock,F as ErrorHandlerBoundary,I as ErrorHandlerProvider,t as ExternalLinkBlock,V as IFrameBridgeProvider,H as IFrameMessageType,J as Image,K as JsonLd,f as ListBlock,c as OneOfBlock,l as OptionalBlock,b as PhoneLinkBlock,M as Preview,X as PreviewContext,$ as PreviewSkeleton,oo as SitePreviewIFrameMessageType,g as SvgImageBlock,d as VideoPreviewImage,h as VimeoVideoBlock,B as YouTubeVideoBlock,W as calculateInheritAspectRatio,A as convertPreviewDataToHeaders,x as createFetchInMemoryCache,T as createFetchWithDefaults,D as createFetchWithPreviewHeaders,Q as createGraphQLFetch,N as createPersistedQueryGraphQLFetch,Y as generateImageUrl,r as getAiContentAltTextWithPrefix,q as getMaxDimensionsFromArea,S as gql,a as hasRichTextBlockContent,k as hasTipTapRichTextContent,R as isWithPreviewPropsData,z as parseAspectRatio,e as recursivelyLoadBlockData,j as renderTipTapRichText,_ as sendSitePreviewIFrameMessage,O as useBlockPreviewFetch,w as useCookieApi,P as useCookieBotCookieApi,y as useIFrameBridge,n as useIsElementInViewport,L as useLocalStorageCookieApi,C as useOneTrustCookieApi,Z as usePreview,G as withPreview};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { Thing, WithContext } from 'schema-dts';
|
|
3
|
+
export type JsonLdProps<T extends Thing> = {
|
|
4
|
+
data: WithContext<T>;
|
|
5
|
+
};
|
|
6
|
+
export declare const JsonLd: <T extends Thing>({ data }: JsonLdProps<T>) => JSX.Element;
|
|
7
|
+
//# sourceMappingURL=JsonLd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JsonLd.d.ts","sourceRoot":"","sources":["../../src/jsonLd/JsonLd.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAErD,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,KAAK,IAAI;IACvC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;CACxB,CAAC;AAOF,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,KAAK,EAAE,UAAU,WAAW,CAAC,CAAC,CAAC,KAAG,GAAG,CAAC,OAEtE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";const t=({data:t})=>{/* @__PURE__ */return r("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:(e=JSON.stringify(t),e.replace(/</g,"\\u003c"))}});var e};export{t as JsonLd};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createPersistedQueryGraphQLFetch.d.ts","sourceRoot":"","sources":["../../src/persistedQueries/createPersistedQueryGraphQLFetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEjE,KAAK,KAAK,GAAG,OAAO,KAAK,CAAC;AAE1B,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,GAAG,YAAY,CAoExF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e,r){return async function(s,a,t){if("string"==typeof s)throw new Error("at runtime only hashed queries are supported");const n=s.hash;let o;if("GET"===t?.method){const s=new URL(r,window.location.origin);s.searchParams.append("extensions.persistedQuery.sha256Hash",n),s.searchParams.append("variables",JSON.stringify(a)),o=await e(s,{...t,headers:{"Apollo-Require-Preflight":"true",...t.headers}})}else o=await e(r,{method:"POST",...t,headers:{"Content-Type":"application/json",...t?.headers},body:JSON.stringify({extensions:{persistedQuery:{version:1,sha256Hash:n}},variables:a})});if(!o.ok){let e=`Network response was not ok. Status: ${o.status}`;const r=await o.text();try{const s=JSON.parse(r),{errors:a}=s;a&&(e+=`\n\nGraphQL error(s):\n- ${a.map(e=>e.message).join("\n- ")}`)}catch{e+=`\n${r}`}throw new Error(e)}const{data:i,errors:h}=await o.json();if(h)throw new Error(`GraphQL error(s):\n- ${h.map(e=>e.message).join("\n- ")}`);return i}}export{e as createPersistedQueryGraphQLFetch};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function persistedQueryRoute(req: Request, { graphqlTarget, headers: headersInit, persistedQueriesPath, cacheMaxAge, }: {
|
|
2
|
+
graphqlTarget: string;
|
|
3
|
+
headers?: HeadersInit;
|
|
4
|
+
persistedQueriesPath: string;
|
|
5
|
+
cacheMaxAge: number | undefined;
|
|
6
|
+
}): Promise<Response>;
|
|
7
|
+
//# sourceMappingURL=persistedQueryRoute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persistedQueryRoute.d.ts","sourceRoot":"","sources":["../../src/persistedQueries/persistedQueryRoute.ts"],"names":[],"mappings":"AA8CA,wBAAsB,mBAAmB,CACrC,GAAG,EAAE,OAAO,EACZ,EACI,aAAa,EACb,OAAO,EAAE,WAAW,EACpB,oBAAgD,EAChD,WAAW,GACd,EAAE;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,WAAW,CAAC;IAAC,oBAAoB,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,qBAoErH"}
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LoaderContext } from 'webpack';
|
|
2
|
+
interface GqlHashLoaderOptions {
|
|
3
|
+
persistedQueriesPath?: string;
|
|
4
|
+
}
|
|
5
|
+
declare const webpackPersistedQueriesLoader: (this: LoaderContext<GqlHashLoaderOptions>, source: string) => string;
|
|
6
|
+
export default webpackPersistedQueriesLoader;
|
|
7
|
+
//# sourceMappingURL=webpackPersistedQueriesLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpackPersistedQueriesLoader.d.ts","sourceRoot":"","sources":["../../src/persistedQueries/webpackPersistedQueriesLoader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,UAAU,oBAAoB;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACjC;AAqBD,QAAA,MAAM,6BAA6B,GAAa,MAAM,aAAa,CAAC,oBAAoB,CAAC,EAAE,QAAQ,MAAM,WAqCxG,CAAC;AAEF,eAAe,6BAA6B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
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};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface PreviewContextOptions {
|
|
2
|
+
previewType: "SitePreview" | "BlockPreview" | "NoPreview";
|
|
3
|
+
showPreviewSkeletons: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const PreviewContext: import('react').Context<PreviewContextOptions>;
|
|
6
|
+
//# sourceMappingURL=PreviewContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreviewContext.d.ts","sourceRoot":"","sources":["../../src/preview/PreviewContext.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,qBAAqB;IAClC,WAAW,EAAE,aAAa,GAAG,cAAc,GAAG,WAAW,CAAC;IAC1D,oBAAoB,EAAE,OAAO,CAAC;CACjC;AAOD,eAAO,MAAM,cAAc,gDAAmE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PreviewContextOptions } from './PreviewContext';
|
|
2
|
+
interface PreviewHookReturn extends PreviewContextOptions {
|
|
3
|
+
isSelected: (url: string, options?: {
|
|
4
|
+
exactMatch?: boolean;
|
|
5
|
+
}) => boolean;
|
|
6
|
+
isHovered: (url: string, options?: {
|
|
7
|
+
exactMatch?: boolean;
|
|
8
|
+
}) => boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function usePreview(): PreviewHookReturn;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=usePreview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePreview.d.ts","sourceRoot":"","sources":["../../src/preview/usePreview.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkB,KAAK,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE9E,UAAU,iBAAkB,SAAQ,qBAAqB;IACrD,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC;IACzE,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC;CAC3E;AAED,wBAAgB,UAAU,IAAI,iBAAiB,CAqC9C"}
|
|
@@ -0,0 +1 @@
|
|
|
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};
|