/* Brainstorm X — Naming wizard. Controlled, persists a real session. */
(function () {
const { useState } = React;
const DS = window.BrainstormXDesignSystem_f2a458;
const { Button, Card, Input, Textarea, Chip, SentimentSlider, ProgressSteps } = DS;
const I = window.BXIcons;
const STEPS = ['Basics', 'Keywords', 'Feeling', 'Style', 'Review'];
const PROJECT_TYPES = ['Business name', 'Product name', 'App / platform', 'Service name', 'Event name', 'Campaign name'];
const QUICK_CHIPS = ['Fun', 'Clever', 'Clean', 'Technical', 'Luxurious', 'Quirky', 'Warm', 'Direct', 'Inventive', 'Trustworthy'];
const STYLE_OPTS = [
['Brandable', 'Invented, like Google'], ['Evocative', 'Energy, like Red Bull'],
['Short phrase', 'Like Dollar Shave Club'], ['Compound', 'Blended, like FedEx'],
['Alternate spelling', 'Like Lyft'], ['Real words', 'Like Apple'],
];
const AXES = [['Playful', 'Serious', 'Playful'], ['Premium', 'Affordable', 'Premium'], ['Minimal', 'Expressive', 'Minimal'], ['Safe', 'Unusual', 'Safe']];
function Shell({ step, children, onBack, onNext, nextLabel, canBack, busy }) {
return (
Brainstorm X
{children}
}>{canBack ? 'Back' : 'Cancel'}
}>{busy ? 'Generating…' : (nextLabel || 'Continue')}
);
}
function Field({ label, children, hint }) {
return (
{label}
{children}
{hint &&
{hint}
}
);
}
function Wizard({ initial, onComplete, onCancel, busy }) {
const init = initial || {};
const [step, setStep] = useState(0);
const [project, setProject] = useState(init.project || '');
const [type, setType] = useState(init.type || 'Business name');
const [industry, setIndustry] = useState(init.industry || '');
const [audience, setAudience] = useState(init.audience || '');
const [description, setDescription] = useState(init.description || '');
const [kw, setKw] = useState(init.keywordsList || []);
const [kwInput, setKwInput] = useState('');
const [avoid, setAvoid] = useState(init.avoid || []);
const [avoidInput, setAvoidInput] = useState('');
const [styles, setStyles] = useState(() => {
const o = {}; (init.styles || ['Brandable', 'Evocative', 'Compound']).forEach((s) => { o[s] = true; }); return o;
});
const [chips, setChips] = useState(() => {
const o = {}; (init.chips || ['Quirky', 'Fun']).forEach((c) => { o[c] = true; }); return o;
});
const [axes, setAxes] = useState(() => AXES.map(([l, r, key]) => (init.personality && init.personality[key] != null ? init.personality[key] : 50)));
const [randomness, setRandomness] = useState(init.randomness || 'Medium');
const editing = !!initial;
const last = STEPS.length - 1;
const toggle = (obj, set, k) => set({ ...obj, [k]: !obj[k] });
const addKw = (e) => { e.preventDefault(); const v = kwInput.trim(); if (v && !kw.includes(v)) setKw([...kw, v]); setKwInput(''); };
const addAvoid = (e) => { e.preventDefault(); const v = avoidInput.trim(); if (v && !avoid.includes(v)) setAvoid([...avoid, v]); setAvoidInput(''); };
const back = () => (step > 0 ? setStep(step - 1) : onCancel && onCancel());
const next = () => {
if (step < last) { setStep(step + 1); return; }
const personality = {};
AXES.forEach(([l, r, key], i) => { personality[key] = axes[i]; });
onComplete && onComplete({
project: project.trim() || 'Untitled session', type, industry: industry.trim(), audience: audience.trim(),
description: description.trim(), keywordsList: kw, avoid, randomness, personality,
styles: Object.keys(styles).filter((k) => styles[k]),
chips: Object.keys(chips).filter((k) => chips[k]),
});
};
const heads = [
['What are you naming?', "Let's train your naming session — answer a few quick questions and we'll generate your first set of ideas."],
['Add your keywords', 'Add words, themes or existing names that point the AI in the right direction.'],
['Feeling & personality', 'Slide towards the qualities that fit your brand. Add a few quick chips too.'],
['Name style', 'Pick one or more styles. You can always change this later.'],
['Review & generate', "Check your brief — we'll generate your first wave of names and open the arena."],
];
const nextLabel = step === last ? (editing ? 'Save & continue' : 'Generate first wave') : 'Continue';
return (
0} nextLabel={nextLabel} busy={busy}>
Step {step + 1} of {STEPS.length}
{heads[step][0]}
{heads[step][1]}
{step === 0 && (<>
setProject(e.target.value)} />
{PROJECT_TYPES.map((tp) => setType(tp)}>{tp})}
setIndustry(e.target.value)} />
setAudience(e.target.value)} />
>)}
{step === 1 && (<>
{kw.length === 0 && No keywords yet — add a few above.}
{kw.map((k) => setKw(kw.filter((x) => x !== k))}>{k})}
{avoid.map((k) => setAvoid(avoid.filter((x) => x !== k))}>{k})}
>)}
{step === 2 && (<>
{AXES.map(([l, r], i) => (
setAxes(axes.map((a, j) => (j === i ? v : a)))} />
))}
{QUICK_CHIPS.map((c) => toggle(chips, setChips, c)}>{c})}
>)}
{step === 3 && (<>
{STYLE_OPTS.map(([name, eg]) => {
const on = !!styles[name];
return (
);
})}
{['Low', 'Medium', 'High'].map((r) => setRandomness(r)}>{r})}
>)}
{step === 4 && (<>
{industry && }
{audience && }
{avoid.length > 0 && }
styles[k]).join(', ') || 'Brandable'} />
Ready — we'll generate your first wave of names and open the Name Arena.
>)}
);
}
function ReviewRow({ label, value }) {
return (
{label}
{value}
);
}
window.BXWizard = Wizard;
})();