WIP jordan
This commit is contained in:
37
app/composables/useQuoteRequestEmailEnabled.ts
Normal file
37
app/composables/useQuoteRequestEmailEnabled.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user