Files
AnchorOS/lib/webhook.ts
Marco Gallegos 66e20d25a7 feat: Add Formbricks integration, update forms with webhooks, enhance navigation
- Integrate @formbricks/js for future surveys (FormbricksProvider)
- Add WebhookForm component for unified form submission (contact/franchise/membership)
- Update contact form with reason dropdown field
- Update franchise form with new fields: estado, ciudad, socios checkbox
- Update franchise benefits: manuals, training platform, RH system, investment $100k
- Add Contacto link to desktop/mobile nav and footer
- Update membership form to use WebhookForm with membership_id select
- Update hero buttons to use #3E352E color consistently
- Refactor contact/franchise pages to use new hero layout and components
- Add webhook utility (lib/webhook.ts) for parallel submission to test+prod
- Add email receipt hooks to booking endpoints
- Update globals.css with new color variables and navigation styles
- Docker configuration for deployment
2026-01-17 22:54:20 -06:00

38 lines
980 B
TypeScript

export const WEBHOOK_ENDPOINTS = [
'https://flows.soul23.cloud/webhook-test/4YZ7RPfo1GT',
'https://flows.soul23.cloud/webhook/4YZ7RPfo1GT'
]
export const getDeviceType = () => {
if (typeof window === 'undefined') {
return 'unknown'
}
return window.matchMedia('(max-width: 768px)').matches ? 'mobile' : 'desktop'
}
export const sendWebhookPayload = async (payload: Record<string, string>) => {
const results = await Promise.allSettled(
WEBHOOK_ENDPOINTS.map(async (endpoint) => {
const response = await fetch(endpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(payload)
})
if (!response.ok) {
throw new Error('Webhook error')
}
return response
})
)
const hasSuccess = results.some((result) => result.status === 'fulfilled')
if (!hasSuccess) {
throw new Error('No se pudo enviar la solicitud a los webhooks.')
}
}