diff --git a/mintlify/docs.json b/mintlify/docs.json index b5ef95f7..790fa695 100644 --- a/mintlify/docs.json +++ b/mintlify/docs.json @@ -61,6 +61,17 @@ } ] }, + { + "tab": "Build your flow", + "groups": [ + { + "group": "Build your flow", + "pages": [ + "flow-builder" + ] + } + ] + }, { "tab": "Payouts & B2B", "groups": [ @@ -298,7 +309,7 @@ }, "footer": {}, "head": { - "raw": "", + "raw": "", "links": [ { "rel": "preload", diff --git a/mintlify/flow-builder.mdx b/mintlify/flow-builder.mdx new file mode 100644 index 00000000..e9fb36a1 --- /dev/null +++ b/mintlify/flow-builder.mdx @@ -0,0 +1,67 @@ +--- +title: "Build your flow" +description: "Design your flow and get the API calls for your exact use case" +mode: "custom" +"og:image": "/images/og/og-flow-builder.png" +--- + +export const FlowBuilderEmbed = () => { + const [src, setSrc] = React.useState(null); + + React.useEffect(() => { + const isDark = document.documentElement.classList.contains('dark'); + setSrc('https://grid-visualizer-opal.vercel.app/?embed=true&theme=' + (isDark ? 'dark' : 'light')); + + let ignoreNextMutation = false; + + const sendTheme = () => { + const t = document.documentElement.classList.contains('dark') ? 'dark' : 'light'; + const iframe = document.getElementById('flow-builder-iframe'); + if (iframe && iframe.contentWindow) { + iframe.contentWindow.postMessage({ type: 'theme-sync', theme: t }, '*'); + } + }; + + const handleMessage = (e) => { + if (e.data && e.data.type === 'theme-request') { + sendTheme(); + return; + } + if (e.data && e.data.type === 'theme-sync') { + const isDark = document.documentElement.classList.contains('dark'); + const wantsDark = e.data.theme === 'dark'; + if (isDark !== wantsDark) { + ignoreNextMutation = true; + document.documentElement.classList.toggle('dark'); + } + } + }; + window.addEventListener('message', handleMessage); + + const obs = new MutationObserver(() => { + if (ignoreNextMutation) { ignoreNextMutation = false; return; } + sendTheme(); + }); + obs.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] }); + + return () => { + window.removeEventListener('message', handleMessage); + obs.disconnect(); + }; + }, []); + + if (!src) return null; + + return ( +