| 1 |
/** |
| 2 |
* Pro Upgrade Dialog Store |
| 3 |
* |
| 4 |
* Centralized store for managing Pro feature upgrade dialogs |
| 5 |
*/ |
| 6 |
|
| 7 |
import { defineStore } from 'pinia' |
| 8 |
import { ref } from 'vue' |
| 9 |
import type { Ref } from 'vue' |
| 10 |
|
| 11 |
type ButtonType = 'primary' | 'secondary' | 'tertiary' |
| 12 |
|
| 13 |
export type ProUpgradeDialogData = { |
| 14 |
title: string |
| 15 |
subtitle?: string |
| 16 |
iconName?: string |
| 17 |
buttons?: { |
| 18 |
close?: { |
| 19 |
type?: ButtonType |
| 20 |
text: string |
| 21 |
function?: () => void |
| 22 |
} |
| 23 |
confirm?: { |
| 24 |
type?: ButtonType |
| 25 |
text: string |
| 26 |
function?: () => void |
| 27 |
} |
| 28 |
} |
| 29 |
} |
| 30 |
|
| 31 |
export const useProUpgradeDialogStore = defineStore('proUpgradeDialog', () => { |
| 32 |
const dialogVisible: Ref<boolean> = ref(false) |
| 33 |
const dialogData: Ref<ProUpgradeDialogData> = ref({ |
| 34 |
title: '', |
| 35 |
subtitle: '', |
| 36 |
}) |
| 37 |
|
| 38 |
const showDialog = (data: ProUpgradeDialogData) => { |
| 39 |
dialogData.value = data |
| 40 |
dialogVisible.value = true |
| 41 |
} |
| 42 |
|
| 43 |
const hideDialog = () => { |
| 44 |
dialogVisible.value = false |
| 45 |
} |
| 46 |
|
| 47 |
return { |
| 48 |
dialogVisible, |
| 49 |
dialogData, |
| 50 |
showDialog, |
| 51 |
hideDialog, |
| 52 |
} |
| 53 |
}) |
| 54 |
|