38 lines
957 B
TypeScript
38 lines
957 B
TypeScript
const STORAGE_KEY = 'policy-ui.quote-request-email.v1'
|
|
|
|
/**
|
|
* When false, quote flows record the intent locally but do not describe outbound provider emails
|
|
* (use when rates come from in-app tables, AI, or carrier APIs instead).
|
|
*/
|
|
export function useQuoteRequestEmailEnabled() {
|
|
const quoteRequestEmailEnabled = ref(true)
|
|
|
|
function read() {
|
|
if (!import.meta.client) return
|
|
try {
|
|
const v = localStorage.getItem(STORAGE_KEY)
|
|
if (v === '0') quoteRequestEmailEnabled.value = false
|
|
else if (v === '1') quoteRequestEmailEnabled.value = true
|
|
} catch {
|
|
/* ignore */
|
|
}
|
|
}
|
|
|
|
function setQuoteRequestEmailEnabled(v: boolean) {
|
|
quoteRequestEmailEnabled.value = v
|
|
if (!import.meta.client) return
|
|
try {
|
|
localStorage.setItem(STORAGE_KEY, v ? '1' : '0')
|
|
} catch {
|
|
/* ignore */
|
|
}
|
|
}
|
|
|
|
onMounted(() => read())
|
|
|
|
return {
|
|
quoteRequestEmailEnabled,
|
|
setQuoteRequestEmailEnabled
|
|
}
|
|
}
|