feat: 업체 직접 입력 시 공식 홈페이지 링크 입력란 추가
- BusinessNameInputModal에 선택 입력 URL 필드 추가 (프로토콜 미입력 시 https:// 보정) - onManualInput 콜백 체인(officialSiteUrl) 확장 - POST /marketing 요청 body에 official_site_url 전달 (미입력 시 null) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DKTAqpFj8pbWzgvq7MRDHk
This commit is contained in:
parent
547dd415c5
commit
e328fc950c
@ -354,14 +354,14 @@ const App: React.FC = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 업체명·주소 수동 입력으로 마케팅 분석 API 호출
|
// 업체명·주소 수동 입력으로 마케팅 분석 API 호출
|
||||||
const handleManualInput = async (businessName: string, address: string, category: string) => {
|
const handleManualInput = async (businessName: string, address: string, category: string, officialSiteUrl?: string) => {
|
||||||
setAfterLoadTarget('generation_flow');
|
setAfterLoadTarget('generation_flow');
|
||||||
setViewMode('loading');
|
setViewMode('loading');
|
||||||
setIsAnalysisComplete(false);
|
setIsAnalysisComplete(false);
|
||||||
setError(null);
|
setError(null);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const data = await marketingAnalysis(businessName, address, category);
|
const data = await marketingAnalysis(businessName, address, category, officialSiteUrl);
|
||||||
|
|
||||||
if (!validateCrawlingResponse(data)) {
|
if (!validateCrawlingResponse(data)) {
|
||||||
throw new Error(t('app.autocompleteError'));
|
throw new Error(t('app.autocompleteError'));
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import CitySelectModal, { REGIONS } from './CitySelectModal';
|
|||||||
|
|
||||||
interface BusinessNameInputModalProps {
|
interface BusinessNameInputModalProps {
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
onSubmit: (businessName: string, address: string, category: string) => void;
|
onSubmit: (businessName: string, address: string, category: string, officialSiteUrl: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const BusinessNameInputModal: React.FC<BusinessNameInputModalProps> = ({ onClose, onSubmit }) => {
|
const BusinessNameInputModal: React.FC<BusinessNameInputModalProps> = ({ onClose, onSubmit }) => {
|
||||||
@ -14,6 +14,7 @@ const BusinessNameInputModal: React.FC<BusinessNameInputModalProps> = ({ onClose
|
|||||||
const [selectedCity, setSelectedCity] = useState('');
|
const [selectedCity, setSelectedCity] = useState('');
|
||||||
const [detailAddress, setDetailAddress] = useState('');
|
const [detailAddress, setDetailAddress] = useState('');
|
||||||
const [category, setCategory] = useState('');
|
const [category, setCategory] = useState('');
|
||||||
|
const [officialSiteUrl, setOfficialSiteUrl] = useState('');
|
||||||
const [isCityModalOpen, setIsCityModalOpen] = useState(false);
|
const [isCityModalOpen, setIsCityModalOpen] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -42,7 +43,12 @@ const BusinessNameInputModal: React.FC<BusinessNameInputModalProps> = ({ onClose
|
|||||||
const handleSubmit = () => {
|
const handleSubmit = () => {
|
||||||
if (!isValid) return;
|
if (!isValid) return;
|
||||||
const fullAddress = `${selectedCity} ${detailAddress.trim()}`;
|
const fullAddress = `${selectedCity} ${detailAddress.trim()}`;
|
||||||
onSubmit(businessName.trim(), fullAddress, category.trim());
|
// 프로토콜 없이 입력하면 https:// 를 붙여서 전달
|
||||||
|
const trimmedUrl = officialSiteUrl.trim();
|
||||||
|
const normalizedUrl = trimmedUrl && !/^https?:\/\//i.test(trimmedUrl)
|
||||||
|
? `https://${trimmedUrl}`
|
||||||
|
: trimmedUrl;
|
||||||
|
onSubmit(businessName.trim(), fullAddress, category.trim(), normalizedUrl);
|
||||||
onClose();
|
onClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -118,6 +124,19 @@ const BusinessNameInputModal: React.FC<BusinessNameInputModalProps> = ({ onClose
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="manual-modal-field">
|
||||||
|
<label className="manual-modal-label">{t('landing.hero.manualLabelSiteUrl')}</label>
|
||||||
|
<input
|
||||||
|
type="url"
|
||||||
|
className="manual-modal-input"
|
||||||
|
placeholder={t('landing.hero.manualPlaceholderSiteUrl')}
|
||||||
|
value={officialSiteUrl}
|
||||||
|
onChange={e => setOfficialSiteUrl(e.target.value)}
|
||||||
|
onKeyDown={handleKeyDown}
|
||||||
|
maxLength={2048}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="manual-modal-actions">
|
<div className="manual-modal-actions">
|
||||||
<button type="button" className="manual-modal-cancel" onClick={onClose}>
|
<button type="button" className="manual-modal-cancel" onClick={onClose}>
|
||||||
{t('common.cancel')}
|
{t('common.cancel')}
|
||||||
|
|||||||
@ -38,7 +38,7 @@ const extractUrl = (text: string): string | null => {
|
|||||||
interface SearchInputFormProps {
|
interface SearchInputFormProps {
|
||||||
onAnalyze?: (value: string, type: SearchType) => void;
|
onAnalyze?: (value: string, type: SearchType) => void;
|
||||||
onAutocomplete?: (data: AutocompleteRequest) => void;
|
onAutocomplete?: (data: AutocompleteRequest) => void;
|
||||||
onManualInput?: (businessName: string, address: string, category: string) => void;
|
onManualInput?: (businessName: string, address: string, category: string, officialSiteUrl?: string) => void;
|
||||||
/** 직접입력 버튼 클릭 시 기본 동작(모달 열기)을 대체합니다. 제공 시 모달을 직접 관리해야 합니다. */
|
/** 직접입력 버튼 클릭 시 기본 동작(모달 열기)을 대체합니다. 제공 시 모달을 직접 관리해야 합니다. */
|
||||||
onManualButtonClick?: () => void;
|
onManualButtonClick?: () => void;
|
||||||
error?: string | null;
|
error?: string | null;
|
||||||
@ -340,9 +340,9 @@ const SearchInputForm: React.FC<SearchInputFormProps> = ({
|
|||||||
{!onManualButtonClick && isManualModalOpen && (
|
{!onManualButtonClick && isManualModalOpen && (
|
||||||
<BusinessNameInputModal
|
<BusinessNameInputModal
|
||||||
onClose={() => setIsManualModalOpen(false)}
|
onClose={() => setIsManualModalOpen(false)}
|
||||||
onSubmit={(businessName, address, category) => {
|
onSubmit={(businessName, address, category, officialSiteUrl) => {
|
||||||
setIsManualModalOpen(false);
|
setIsManualModalOpen(false);
|
||||||
onManualInput?.(businessName, address, category);
|
onManualInput?.(businessName, address, category, officialSiteUrl);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -208,7 +208,9 @@
|
|||||||
"manualPlaceholderAddress": "Enter the address",
|
"manualPlaceholderAddress": "Enter the address",
|
||||||
"manualPlaceholderRegion": "Select a region",
|
"manualPlaceholderRegion": "Select a region",
|
||||||
"manualPlaceholderDetail": "Enter detail address (e.g. Gangnam-gu Teheran-ro 123)",
|
"manualPlaceholderDetail": "Enter detail address (e.g. Gangnam-gu Teheran-ro 123)",
|
||||||
"manualPlaceholderCategory": "Enter the business category (e.g. pension, cafe, salon)"
|
"manualPlaceholderCategory": "Enter the business category (e.g. pension, cafe, salon)",
|
||||||
|
"manualLabelSiteUrl": "Website link (optional)",
|
||||||
|
"manualPlaceholderSiteUrl": "Enter the official website URL (e.g. https://example.com)"
|
||||||
},
|
},
|
||||||
"welcome": {
|
"welcome": {
|
||||||
"title": "Welcome to ADO2.AI",
|
"title": "Welcome to ADO2.AI",
|
||||||
|
|||||||
@ -207,7 +207,9 @@
|
|||||||
"manualPlaceholderAddress": "주소를 입력하세요.",
|
"manualPlaceholderAddress": "주소를 입력하세요.",
|
||||||
"manualPlaceholderRegion": "지역을 선택하세요.",
|
"manualPlaceholderRegion": "지역을 선택하세요.",
|
||||||
"manualPlaceholderDetail": "상세 주소를 입력하세요. (예: 강남구 테헤란로 123)",
|
"manualPlaceholderDetail": "상세 주소를 입력하세요. (예: 강남구 테헤란로 123)",
|
||||||
"manualPlaceholderCategory": "업종을 입력하세요. (예: 펜션, 카페, 미용실)"
|
"manualPlaceholderCategory": "업종을 입력하세요. (예: 펜션, 카페, 미용실)",
|
||||||
|
"manualLabelSiteUrl": "홈페이지 링크 (선택)",
|
||||||
|
"manualPlaceholderSiteUrl": "공식 홈페이지 주소를 입력하세요. (예: https://example.com)"
|
||||||
},
|
},
|
||||||
"welcome": {
|
"welcome": {
|
||||||
"title": "ADO2.AI에 오신 것을 환영합니다.",
|
"title": "ADO2.AI에 오신 것을 환영합니다.",
|
||||||
|
|||||||
@ -299,13 +299,13 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 업체명·주소 수동 입력으로 마케팅 분석 API 호출
|
// 업체명·주소 수동 입력으로 마케팅 분석 API 호출
|
||||||
const handleManualInput = async (businessName: string, address: string, category: string) => {
|
const handleManualInput = async (businessName: string, address: string, category: string, officialSiteUrl?: string) => {
|
||||||
goToWizardStep(-1);
|
goToWizardStep(-1);
|
||||||
setIsAnalysisComplete(false);
|
setIsAnalysisComplete(false);
|
||||||
setAnalysisError(null);
|
setAnalysisError(null);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const data = await marketingAnalysis(businessName, address, category);
|
const data = await marketingAnalysis(businessName, address, category, officialSiteUrl);
|
||||||
|
|
||||||
if (data.processed_info) {
|
if (data.processed_info) {
|
||||||
data.processed_info.customer_name = data.processed_info.customer_name || businessName;
|
data.processed_info.customer_name = data.processed_info.customer_name || businessName;
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import SearchInputForm, { SearchType } from '../../components/SearchInputForm';
|
|||||||
interface UrlInputContentProps {
|
interface UrlInputContentProps {
|
||||||
onAnalyze: (value: string, type?: SearchType) => void;
|
onAnalyze: (value: string, type?: SearchType) => void;
|
||||||
onAutocomplete?: (data: AutocompleteRequest) => void;
|
onAutocomplete?: (data: AutocompleteRequest) => void;
|
||||||
onManualInput?: (businessName: string, address: string, category: string) => void;
|
onManualInput?: (businessName: string, address: string, category: string, officialSiteUrl?: string) => void;
|
||||||
error: string | null;
|
error: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@ const orbConfigs: OrbConfig[] = [
|
|||||||
interface HeroSectionProps {
|
interface HeroSectionProps {
|
||||||
onAnalyze?: (value: string, type?: SearchType) => void;
|
onAnalyze?: (value: string, type?: SearchType) => void;
|
||||||
onAutocomplete?: (data: AutocompleteRequest) => void;
|
onAutocomplete?: (data: AutocompleteRequest) => void;
|
||||||
onManualInput?: (businessName: string, address: string, category: string) => void;
|
onManualInput?: (businessName: string, address: string, category: string, officialSiteUrl?: string) => void;
|
||||||
onNext?: () => void;
|
onNext?: () => void;
|
||||||
error?: string | null;
|
error?: string | null;
|
||||||
scrollProgress?: number;
|
scrollProgress?: number;
|
||||||
@ -184,10 +184,10 @@ const HeroSection: React.FC<HeroSectionProps> = ({ onAnalyze, onAutocomplete, on
|
|||||||
{isManualModalOpen && (
|
{isManualModalOpen && (
|
||||||
<BusinessNameInputModal
|
<BusinessNameInputModal
|
||||||
onClose={() => setIsManualModalOpen(false)}
|
onClose={() => setIsManualModalOpen(false)}
|
||||||
onSubmit={(businessName, address, category) => {
|
onSubmit={(businessName, address, category, officialSiteUrl) => {
|
||||||
if (tutorial.isActive) tutorial.nextHint();
|
if (tutorial.isActive) tutorial.nextHint();
|
||||||
setIsManualModalOpen(false);
|
setIsManualModalOpen(false);
|
||||||
onManualInput?.(businessName, address, category);
|
onManualInput?.(businessName, address, category, officialSiteUrl);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -1093,7 +1093,7 @@ export async function autocomplete(request: AutocompleteRequest): Promise<Crawli
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 업체명·주소 직접 입력으로 마케팅 분석
|
// 업체명·주소 직접 입력으로 마케팅 분석
|
||||||
export async function marketingAnalysis(storeName: string, address: string, category = ''): Promise<CrawlingResponse> {
|
export async function marketingAnalysis(storeName: string, address: string, category = '', officialSiteUrl?: string): Promise<CrawlingResponse> {
|
||||||
const controller = new AbortController();
|
const controller = new AbortController();
|
||||||
const timeoutId = setTimeout(() => controller.abort(), CRAWL_TIMEOUT);
|
const timeoutId = setTimeout(() => controller.abort(), CRAWL_TIMEOUT);
|
||||||
|
|
||||||
@ -1103,7 +1103,12 @@ export async function marketingAnalysis(storeName: string, address: string, cate
|
|||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ store_name: storeName, address, category }),
|
body: JSON.stringify({
|
||||||
|
store_name: storeName,
|
||||||
|
address,
|
||||||
|
category,
|
||||||
|
official_site_url: officialSiteUrl?.trim() || null,
|
||||||
|
}),
|
||||||
signal: controller.signal,
|
signal: controller.signal,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user