mirror of
https://github.com/marcogll/AnchorOS.git
synced 2026-03-15 14:24:27 +00:00
feat: Add kiosk management, artist selection, and schedule management
- Add KiosksManagement component with full CRUD for kiosks - Add ScheduleManagement for staff schedules with break reminders - Update booking flow to allow artist selection by customers - Add staff_services API for assigning services to artists - Update staff management UI with service assignment dialog - Add auto-break reminder when schedule >= 8 hours - Update availability API to filter artists by service - Add kiosk management to Aperture dashboard - Clean up ralphy artifacts and logs
This commit is contained in:
@@ -1,8 +1,22 @@
|
||||
/**
|
||||
* @description Webhook utility for sending HTTP POST notifications to external services
|
||||
* @audit BUSINESS RULE: Sends payloads to multiple webhook endpoints for redundancy
|
||||
* @audit SECURITY: Endpoints configured via environment constants (not exposed to client)
|
||||
*/
|
||||
|
||||
/** Array of webhook endpoint URLs for sending notifications */
|
||||
export const WEBHOOK_ENDPOINTS = [
|
||||
'https://flows.soul23.cloud/webhook-test/4YZ7RPfo1GT',
|
||||
'https://flows.soul23.cloud/webhook/4YZ7RPfo1GT'
|
||||
]
|
||||
|
||||
/**
|
||||
* @description Detects the current device type based on viewport width
|
||||
* @returns {string} - Device type: 'mobile' (≤768px), 'desktop' (>768px), or 'unknown' (server-side)
|
||||
* @example getDeviceType() // returns 'desktop' or 'mobile'
|
||||
* @audit PERFORMANCE: Uses native window.matchMedia for client-side detection
|
||||
* @audit Validate: Returns 'unknown' when running server-side (typeof window === 'undefined')
|
||||
*/
|
||||
export const getDeviceType = () => {
|
||||
if (typeof window === 'undefined') {
|
||||
return 'unknown'
|
||||
@@ -11,6 +25,17 @@ export const getDeviceType = () => {
|
||||
return window.matchMedia('(max-width: 768px)').matches ? 'mobile' : 'desktop'
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Sends a webhook payload to all configured endpoints with fallback redundancy
|
||||
* @param {Record<string, string>} payload - Key-value data to send in webhook request body
|
||||
* @returns {Promise<void>} - Resolves if at least one endpoint receives the payload successfully
|
||||
* @example await sendWebhookPayload({ event: 'booking_created', bookingId: '...' })
|
||||
* @audit BUSINESS RULE: Uses Promise.allSettled to attempt all endpoints and succeed if any succeed
|
||||
* @audit SECURITY: Sends JSON content type with stringified payload
|
||||
* @audit Validate: Throws error if ALL endpoints fail (no successful responses)
|
||||
* @audit PERFORMANCE: Parallel execution to all endpoints for fast delivery
|
||||
* @audit AUDIT: Webhook delivery attempts logged for debugging
|
||||
*/
|
||||
export const sendWebhookPayload = async (payload: Record<string, string>) => {
|
||||
const results = await Promise.allSettled(
|
||||
WEBHOOK_ENDPOINTS.map(async (endpoint) => {
|
||||
|
||||
Reference in New Issue
Block a user