Add product line targeting for experiments

- Add option to target entire product line instead of specific ASINs
- Support pasting multiple ASINs separated by spaces OR commas
- Add ASIN format validation (9-10 alphanumeric characters)
- Load available product lines from cached sales data
- Add handleCreateExperimentForLine function in App.tsx
- Update ExperimentForm with target type selector (ASIN vs Line)

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
Christian Vidal Wolf
2026-02-21 00:40:30 +01:00
co-authored by Qwen-Coder
parent 9736a3d591
commit 46d87127c8
2 changed files with 159 additions and 46 deletions
+11
View File
@@ -65,6 +65,7 @@ const App: React.FC = () => {
const [showCreateExperiment, setShowCreateExperiment] = useState(false);
const [preselectedAsins, setPreselectedAsins] = useState<string[]>([]);
const [preselectedMarketplace, setPreselectedMarketplace] = useState<string>('');
const [preselectedLine, setPreselectedLine] = useState<string>('');
// Modal State
const [isDataModalOpen, setIsDataModalOpen] = useState(false);
@@ -340,6 +341,14 @@ const App: React.FC = () => {
setView('ads');
}, []);
// Create experiment for a specific line
const handleCreateExperimentForLine = useCallback((line: string) => {
if (!line) return;
setPreselectedLine(line);
setPreselectedMarketplace(filters.customer[0] || '');
setShowCreateExperiment(true);
}, [filters.customer]);
// 1. Initial Load from Cache (IndexedDB) or Auto-Fetch Permanent URL
useEffect(() => {
const initApp = async () => {
@@ -1034,12 +1043,14 @@ const App: React.FC = () => {
setShowCreateExperiment(false);
setPreselectedAsins([]);
setPreselectedMarketplace('');
setPreselectedLine('');
}}
onSuccess={() => {
handleExperimentsFetch();
}}
initialAsins={preselectedAsins}
initialMarketplace={preselectedMarketplace}
initialLine={preselectedLine}
/>
)}