{
  "$schema": "https://shadcn-vue.com/schema/registry-item.json",
  "name": "exit-intent-survey",
  "title": "Exit Intent — Survey",
  "type": "registry:block",
  "files": [
    {
      "path": "packages/registry-vue/blocks/exit-intent-survey/ExitIntentSurvey.vue",
      "content": "<script setup lang=\"ts\">\nimport { onBeforeUnmount, onMounted, ref } from 'vue'\nimport { Check } from 'lucide-vue-next'\nimport { Badge } from '@/components/ui/badge'\nimport { Button } from '@/components/ui/button'\nimport { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog'\nimport { Textarea } from '@/components/ui/textarea'\nimport { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group'\n\nconst props = withDefaults(defineProps<{ storageKey?: string }>(), {\n  storageKey: 'uipkge:exit-survey-seen',\n})\n\nconst options = [\n  'Pricing was unclear',\n  'Missing an integration',\n  'Just browsing',\n  'Security questions',\n  'Something else',\n]\n\nconst open = ref(false)\nconst choice = ref('')\nconst detail = ref('')\nconst sent = ref(false)\n\nfunction onPointerOut(event: MouseEvent) {\n  if (event.relatedTarget || event.clientY > 4) return\n  try {\n    if (window.sessionStorage.getItem(props.storageKey) === '1') return\n    window.sessionStorage.setItem(props.storageKey, '1')\n  } catch {\n    // Blocked storage: shows once more this page view, never in a loop.\n  }\n  open.value = true\n  document.removeEventListener('mouseout', onPointerOut)\n}\n\nfunction submit() {\n  if (!choice.value) return\n  sent.value = true\n  // Close on its own rather than making someone dismiss a thank-you.\n  setTimeout(() => (open.value = false), 1400)\n}\n\nonMounted(() => document.addEventListener('mouseout', onPointerOut))\nonBeforeUnmount(() => document.removeEventListener('mouseout', onPointerOut))\n</script>\n\n<template>\n  <div data-slot=\"exit-intent-survey\">\n    <Dialog v-model:open=\"open\">\n      <DialogContent class=\"sm:max-w-md\">\n        <div v-if=\"!sent\">\n          <DialogHeader>\n            <Badge variant=\"secondary\" class=\"w-fit\">One question</Badge>\n            <DialogTitle class=\"mt-3 text-xl leading-snug text-balance\">What were you looking for?</DialogTitle>\n            <DialogDescription>\n              It goes to the people who build the page. No follow-up email unless you ask for one.\n            </DialogDescription>\n          </DialogHeader>\n\n          <ToggleGroup\n            :model-value=\"choice\"\n            type=\"single\"\n            variant=\"outline\"\n            size=\"sm\"\n            class=\"mt-5 flex-wrap justify-start\"\n            aria-label=\"Reason for leaving\"\n            @update:model-value=\"(value) => (choice = typeof value === 'string' ? value : '')\"\n          >\n            <ToggleGroupItem v-for=\"option in options\" :key=\"option\" :value=\"option\">{{ option }}</ToggleGroupItem>\n          </ToggleGroup>\n\n          <Textarea\n            v-model=\"detail\"\n            class=\"mt-3\"\n            rows=\"3\"\n            placeholder=\"Anything more (optional)\"\n            label=\"Anything more (optional)\"\n          />\n\n          <div class=\"mt-4 flex items-center gap-2\">\n            <Button :disabled=\"!choice\" @click=\"submit\">Send</Button>\n            <Button variant=\"ghost\" @click=\"open = false\">Skip</Button>\n          </div>\n        </div>\n\n        <div v-else class=\"py-6 text-center\" aria-live=\"polite\">\n          <span class=\"bg-success/10 mx-auto flex size-10 items-center justify-center rounded-full\">\n            <Check class=\"text-success size-5\" aria-hidden=\"true\" />\n          </span>\n          <p class=\"mt-3 text-sm font-medium\">Thanks — that is genuinely useful.</p>\n        </div>\n      </DialogContent>\n    </Dialog>\n  </div>\n</template>\n",
      "type": "registry:block",
      "target": "~/app/components/blocks/ExitIntentSurvey.vue"
    }
  ],
  "dependencies": [
    "lucide-vue-next"
  ],
  "devDependencies": [],
  "registryDependencies": [
    "https://uipkge.dev/r/vue/badge.json",
    "https://uipkge.dev/r/vue/button.json",
    "https://uipkge.dev/r/vue/dialog.json",
    "https://uipkge.dev/r/vue/textarea.json",
    "https://uipkge.dev/r/vue/toggle-group.json"
  ],
  "description": "One-question exit survey asking what the visitor did not find, with preset answers, an optional free-text field, and a thank-you state that closes itself.",
  "categories": [
    "marketing"
  ],
  "deprecated": true,
  "replacedBy": "exit-intent"
}