Add whatsapp feature

This commit is contained in:
Urtzi Alfaro
2025-11-13 16:01:08 +01:00
parent d7df2b0853
commit 9bc048d360
74 changed files with 9765 additions and 533 deletions

View File

@@ -88,6 +88,7 @@ class ApiClient {
'/auth/register', // Registration
'/auth/login', // Login
'/geocoding', // Geocoding/address search - utility service, no tenant context
'/tenants/register', // Tenant registration - creating new tenant, no existing tenant context
];
const isPublicEndpoint = publicEndpoints.some(endpoint =>

View File

@@ -21,13 +21,20 @@ import { apiClient } from '../client';
export interface HealthChecklistItem {
icon: 'check' | 'warning' | 'alert';
text: string;
text?: string; // Deprecated: Use textKey instead
textKey?: string; // i18n key for translation
textParams?: Record<string, any>; // Parameters for i18n translation
actionRequired: boolean;
}
export interface HeadlineData {
key: string;
params: Record<string, any>;
}
export interface BakeryHealthStatus {
status: 'green' | 'yellow' | 'red';
headline: string;
headline: string | HeadlineData; // Can be string (deprecated) or i18n object
lastOrchestrationRun: string | null;
nextScheduledRun: string;
checklistItems: HealthChecklistItem[];

View File

@@ -6,11 +6,11 @@ import { apiClient } from '../client';
import { UserProgress, UpdateStepRequest } from '../types/onboarding';
// Backend onboarding steps (full list from backend - UPDATED to match refactored flow)
// NOTE: poi-detection removed - now happens automatically in background during tenant registration
export const BACKEND_ONBOARDING_STEPS = [
'user_registered', // Phase 0: User account created (auto-completed)
'bakery-type-selection', // Phase 1: Choose bakery type
'setup', // Phase 2: Basic bakery setup and tenant creation
'poi-detection', // Phase 2a: POI Detection (Location Context)
'upload-sales-data', // Phase 2b: File upload, validation, AI classification
'inventory-review', // Phase 2b: Review AI-detected products with type selection
'initial-stock-entry', // Phase 2b: Capture initial stock levels
@@ -26,10 +26,10 @@ export const BACKEND_ONBOARDING_STEPS = [
];
// Frontend step order for navigation (excludes user_registered as it's auto-completed)
// NOTE: poi-detection removed - now happens automatically in background during tenant registration
export const FRONTEND_STEP_ORDER = [
'bakery-type-selection', // Phase 1: Choose bakery type
'setup', // Phase 2: Basic bakery setup and tenant creation
'poi-detection', // Phase 2a: POI Detection (Location Context)
'upload-sales-data', // Phase 2b: File upload and AI classification
'inventory-review', // Phase 2b: Review AI-detected products
'initial-stock-entry', // Phase 2b: Initial stock levels

View File

@@ -146,6 +146,34 @@ export interface MLInsightsSettings {
ml_confidence_threshold: number;
}
export interface NotificationSettings {
// WhatsApp Configuration
whatsapp_enabled: boolean;
whatsapp_phone_number_id: string;
whatsapp_access_token: string;
whatsapp_business_account_id: string;
whatsapp_api_version: string;
whatsapp_default_language: string;
// Email Configuration
email_enabled: boolean;
email_from_address: string;
email_from_name: string;
email_reply_to: string;
// Notification Preferences
enable_po_notifications: boolean;
enable_inventory_alerts: boolean;
enable_production_alerts: boolean;
enable_forecast_alerts: boolean;
// Notification Channels
po_notification_channels: string[];
inventory_alert_channels: string[];
production_alert_channels: string[];
forecast_alert_channels: string[];
}
export interface TenantSettings {
id: string;
tenant_id: string;
@@ -160,6 +188,7 @@ export interface TenantSettings {
moq_settings: MOQSettings;
supplier_selection_settings: SupplierSelectionSettings;
ml_insights_settings: MLInsightsSettings;
notification_settings: NotificationSettings;
created_at: string;
updated_at: string;
}
@@ -176,6 +205,7 @@ export interface TenantSettingsUpdate {
moq_settings?: Partial<MOQSettings>;
supplier_selection_settings?: Partial<SupplierSelectionSettings>;
ml_insights_settings?: Partial<MLInsightsSettings>;
notification_settings?: Partial<NotificationSettings>;
}
export type SettingsCategory =
@@ -189,7 +219,8 @@ export type SettingsCategory =
| 'safety_stock'
| 'moq'
| 'supplier_selection'
| 'ml_insights';
| 'ml_insights'
| 'notification';
export interface CategoryResetResponse {
category: string;