feat(b2b-assistant): Implement Step 7 (Customer Journey) with tactical focus on Buying Center, Deal-Breakers, and Assets. Add restart functionality for individual steps.

This commit is contained in:
2026-01-14 08:42:14 +00:00
parent 34203e2325
commit 09dbdac817
8 changed files with 166 additions and 98 deletions

View File

@@ -67,7 +67,7 @@ const App: React.FC = () => {
const t = translations[inputData.language];
const STEP_TITLES = t.stepTitles;
const STEP_KEYS: (keyof AnalysisData)[] = ['offer', 'targetGroups', 'personas', 'painPoints', 'gains', 'messages'];
const STEP_KEYS: (keyof AnalysisData)[] = ['offer', 'targetGroups', 'personas', 'painPoints', 'gains', 'messages', 'customerJourney'];
// --- AUTO-SAVE EFFECT ---
useEffect(() => {
@@ -260,9 +260,16 @@ const App: React.FC = () => {
};
if (newAnalysisData.messages.rows.length === 0) newAnalysisData.messages.rows = parseSection("Step 6");
newAnalysisData.customerJourney = {
summary: [],
headers: [],
rows: parseSection("Schritt 7")
};
if (newAnalysisData.customerJourney.rows.length === 0) newAnalysisData.customerJourney.rows = parseSection("Step 7");
setAnalysisData(newAnalysisData);
setGenerationStep(6); // Jump to end
setGenerationStep(7); // Jump to end (now 7)
setProjectName(file.name.replace('.md', ' (Imported)'));
setProjectId(null); // Treat as new project
@@ -321,7 +328,7 @@ const App: React.FC = () => {
}, [inputData]);
const handleGenerateNextStep = useCallback(async () => {
if (generationStep >= 6) return;
if (generationStep >= 7) return;
if (generationStep === 5 && !selectedIndustry) {
setError('Bitte wählen Sie eine Fokus-Branche aus.');
@@ -340,7 +347,7 @@ const App: React.FC = () => {
language: inputData.language,
channels: inputData.channels,
generationStep: generationStep + 1, // Pass the step we want to generate
focusIndustry: generationStep === 5 ? selectedIndustry : undefined,
focusIndustry: (generationStep === 5 || generationStep === 6) ? selectedIndustry : undefined,
}),
});
@@ -443,6 +450,45 @@ const App: React.FC = () => {
}
};
const handleStepRestart = (stepKey: keyof AnalysisData) => {
const stepIndex = STEP_KEYS.indexOf(stepKey);
if (stepIndex === -1) return;
// Reset steps from this index onwards
// But specifically, if I restart Step 2, I want generationStep to be 1 (so I can generate Step 2 again)
// If I restart Step 1 (index 0), I want generationStep to be 0
// But wait, if I restart Step 1 (Offer), that is the "Start Generation" button usually.
// Actually, if I restart Step 1, I basically want to clear everything and go back to step 0.
// If I restart Step 2, I want to keep Step 1, clear Step 2+, and go back to step 1 (ready to generate step 2).
const newGenerationStep = stepIndex;
setGenerationStep(newGenerationStep);
setAnalysisData(prev => {
const newData: Partial<AnalysisData> = { ...prev };
// Remove all keys starting from this step
for (let i = stepIndex; i < STEP_KEYS.length; i++) {
delete newData[STEP_KEYS[i]];
}
return newData;
});
// Also reset other state related to progress
if (stepKey === 'messages' || stepKey === 'targetGroups') {
// If we are resetting before Step 6, clear selection
// Actually if we reset Step 6 (messages), we clear Step 6 data.
if (stepIndex <= 5) {
setBatchStatus(null);
// We might want to keep selectedIndustry if we are just retrying Step 6?
// But the prompt implies "resetting", so clearing selection is safer.
setSelectedIndustry('');
}
}
// If resetting Step 7, clear its specific state if any (none currently)
};
const handleDownloadMarkdown = () => {
if (!analysisData) return;
const markdownContent = generateMarkdown(analysisData as AnalysisData, STEP_TITLES, t.summaryTitle);
@@ -478,6 +524,7 @@ const App: React.FC = () => {
onEnrichRow={canAdd ? handleManualAdd : undefined}
isEnriching={false}
canDeleteRows={canDelete}
onRestart={() => handleStepRestart(stepKey)}
t={t}
/>
);
@@ -661,9 +708,11 @@ const App: React.FC = () => {
{generationStep >= 5 && renderStep('gains', STEP_TITLES.gains)}
{renderContinueButton(6)}
{generationStep >= 6 && renderStep('messages', STEP_TITLES.messages)}
{renderContinueButton(7)}
{generationStep >= 7 && renderStep('customerJourney', STEP_TITLES.customerJourney)}
{generationStep === 6 && !isLoading && (
{generationStep === 7 && !isLoading && (
<div className="p-8 bg-sky-50 dark:bg-sky-900/20 rounded-2xl border border-sky-100 dark:border-sky-800 text-center print:hidden">
<div className="inline-flex items-center justify-center w-12 h-12 rounded-full bg-sky-100 dark:bg-sky-800 mb-4">
<SparklesIcon className="h-6 w-6 text-sky-600 dark:text-sky-300" />