From e97fb694265f63886590d2c68fdf9bd66f47b229 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Tue, 3 Feb 2026 19:37:44 +0530 Subject: [PATCH 1/4] chore: Update banner with new promotion --- .../src/docs/.vitepress/components/TopBar.vue | 51 +++++++++++++------ 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/packages/mermaid/src/docs/.vitepress/components/TopBar.vue b/packages/mermaid/src/docs/.vitepress/components/TopBar.vue index c5b464bb6ea..268813c264e 100644 --- a/packages/mermaid/src/docs/.vitepress/components/TopBar.vue +++ b/packages/mermaid/src/docs/.vitepress/components/TopBar.vue @@ -4,45 +4,66 @@ import { computed, onMounted, type Ref, ref } from 'vue'; interface Taglines { label: string; - url: string; + campaign: string; + button: string; } const taglines: Taglines[] = [ { - label: 'Customize your layout and design in Mermaid Chart’s visual editor!', - url: 'https://www.mermaidchart.com/whiteboard?utm_source=mermaid_js&utm_medium=banner_ad&utm_campaign=visual_editor', + label: 'Use code NEWYEAR for 10% off Mermaid Advanced Editor (limited time)', + campaign: 'variant_a', + button: 'Try now', }, { - label: 'Replace ChatGPT Pro, Mermaid.live, and Lucid Chart with Mermaid Chart', - url: 'https://www.mermaidchart.com/mermaid-ai?utm_source=mermaid_js&utm_medium=banner_ad&utm_campaign=aibundle', + label: 'Limited time: 10% off Mermaid Advanced Editor with code NEWYEAR', + campaign: 'variant_b', + button: 'Claim Discount', }, { - label: 'Diagram live with teammates in Mermaid Chart', - url: 'https://www.mermaidchart.com/landing?utm_source=mermaid_js&utm_medium=banner_ad&utm_campaign=team_collaboration', + label: 'Try Mermaid Advanced Editor — get 10% off with code NEWYEAR', + campaign: 'variant_c', + button: 'Get started', }, ]; +const isRotationEnabled = false; const index: Ref = ref(0); const isPaused: Ref = ref(false); +const isInitialized: Ref = ref(false); const route = useRoute(); const isHomePage = computed(() => { return route.path === '/'; }); +const currentUrl = computed(() => { + const isMermaidAi = window?.location.hostname.endsWith('mermaid.ai'); + const params = new URLSearchParams({ + utm_medium: 'banner_ad', + utm_campaign: taglines[index.value].campaign, + utm_source: isMermaidAi ? 'ai_open_source' : 'mermaid_js', + }); + return `https://mermaid.ai/?${params.toString()}`; +}); + onMounted(() => { index.value = Math.floor(Math.random() * taglines.length); - setInterval(() => { - if (isPaused.value) { - return; - } - index.value = (index.value + 1) % taglines.length; - }, 5_000); + isInitialized.value = true; + + if (isRotationEnabled) { + setInterval(() => { + if (isPaused.value) { + return; + } + index.value = (index.value + 1) % taglines.length; + }, 5_000); + } });