Line data Source code
1 : import { computed, onMounted, onUnmounted, ref } from 'vue'
2 :
3 2355 : const mountedPrompts = ref(0)
4 :
5 : /**
6 : * Registers a mounted Run-slot subscribe prompt for the caller's lifetime.
7 : * The billing flag alone is not evidence a prompt is on screen — builder
8 : * mode unmounts the actionbar, Linear mode needs outputs, and the wrapper
9 : * withholds the prompt for sales-managed and payment-recovery states — so
10 : * anything yielding to the prompt must key on real presence.
11 : */
12 0 : export function registerSubscribeToRunPrompt() {
13 0 : onMounted(() => {
14 0 : mountedPrompts.value += 1
15 : })
16 0 : onUnmounted(() => {
17 0 : mountedPrompts.value = Math.max(0, mountedPrompts.value - 1)
18 : })
19 : }
20 :
21 : /** Whether any Run-slot subscribe prompt is currently on screen. */
22 2021 : export function useSubscribeToRunPromptPresence() {
23 2021 : return computed(() => mountedPrompts.value > 0)
24 : }
|