Integrate categorization & stock steps with Tour system

- Updated WizardContext with new state management:
  - Added categorizedProducts and productsWithStock state
  - Added categorizationCompleted and stockEntryCompleted flags
  - Implemented updateCategorizedProducts() and updateProductsWithStock() methods
  - Updated getVisibleSteps() to include new steps in AI-assisted path

- Integrated ProductCategorizationStep and InitialStockEntryStep into UnifiedOnboardingWizard:
  - Added conditional rendering based on AI analysis completion
  - Wired up state management for both steps
  - Added intermediate update handlers

- Integrated Tour system at app level:
  - Added TourProvider to App.tsx context hierarchy
  - Added Tour component for rendering active tours
  - Added TourButton to Sidebar navigation
  - Tour button visible when sidebar is expanded

This completes the Phase 6.5 integration and sets up the guided tour infrastructure.
This commit is contained in:
Claude
2025-11-06 13:07:01 +00:00
parent a812291df6
commit 63d100f1b3
4 changed files with 71 additions and 1 deletions

View File

@@ -13,6 +13,8 @@ import {
DataSourceChoiceStep,
RegisterTenantStep,
UploadSalesDataStep,
ProductCategorizationStep,
InitialStockEntryStep,
ProductionProcessesStep,
MLTrainingStep,
CompletionStep
@@ -89,6 +91,22 @@ const OnboardingWizardContent: React.FC = () => {
isConditional: true,
condition: (ctx) => ctx.state.dataSource === 'ai-assisted',
},
{
id: 'product-categorization',
title: t('onboarding:steps.categorization.title', 'Categorizar Productos'),
description: t('onboarding:steps.categorization.description', 'Clasifica ingredientes vs productos'),
component: ProductCategorizationStep,
isConditional: true,
condition: (ctx) => ctx.state.dataSource === 'ai-assisted' && ctx.state.aiAnalysisComplete,
},
{
id: 'initial-stock-entry',
title: t('onboarding:steps.stock.title', 'Niveles de Stock'),
description: t('onboarding:steps.stock.description', 'Cantidades iniciales'),
component: InitialStockEntryStep,
isConditional: true,
condition: (ctx) => ctx.state.dataSource === 'ai-assisted' && ctx.state.categorizationCompleted,
},
// Phase 2b: Core Data Entry
{
id: 'suppliers-setup',
@@ -322,6 +340,14 @@ const OnboardingWizardContent: React.FC = () => {
wizardContext.updateAISuggestions(data.aiSuggestions);
wizardContext.setAIAnalysisComplete(true);
}
if (currentStep.id === 'product-categorization' && data?.categorizedProducts) {
wizardContext.updateCategorizedProducts(data.categorizedProducts);
wizardContext.markStepComplete('categorizationCompleted');
}
if (currentStep.id === 'initial-stock-entry' && data?.productsWithStock) {
wizardContext.updateProductsWithStock(data.productsWithStock);
wizardContext.markStepComplete('stockEntryCompleted');
}
if (currentStep.id === 'inventory-setup') {
wizardContext.markStepComplete('inventoryCompleted');
}
@@ -381,6 +407,12 @@ const OnboardingWizardContent: React.FC = () => {
if (currentStep.id === 'data-source-choice' && data?.dataSource) {
wizardContext.updateDataSource(data.dataSource as DataSource);
}
if (currentStep.id === 'product-categorization' && data?.categorizedProducts) {
wizardContext.updateCategorizedProducts(data.categorizedProducts);
}
if (currentStep.id === 'initial-stock-entry' && data?.productsWithStock) {
wizardContext.updateProductsWithStock(data.productsWithStock);
}
};
// Show loading state