Rocky_Mountain_Vending/lib/site-chat/intents.ts

37 lines
1,006 B
TypeScript

export const CHAT_INTENT_OPTIONS = [
"Free Placement",
"Repairs",
"Moving (Vending Machine or Safe)",
"Manuals",
"Machine Sales",
"Other",
] as const
export const CONTACT_INTENT_OPTIONS = CHAT_INTENT_OPTIONS.filter(
(option) => option !== "Free Placement"
)
export function isFreePlacementIntent(intent: string | undefined | null) {
return (
String(intent || "")
.trim()
.toLowerCase() === "free placement"
)
}
export function isRepairOrMovingIntent(intent: string | undefined | null) {
const value = String(intent || "")
.trim()
.toLowerCase()
return value === "repairs" || value === "moving (vending machine or safe)"
}
export function getBestIntentFormHref(intent: string | undefined | null) {
return isFreePlacementIntent(intent)
? "/#request-machine"
: "/contact-us#contact-form"
}
export function getBestIntentFormLabel(intent: string | undefined | null) {
return isFreePlacementIntent(intent) ? "free placement form" : "contact form"
}