[feat] solution/backend,site: 예약 버튼을 네이버 예약 화면으로 — 검색 화면이 뜨던 것

발행본의 예약 버튼이 네이버 플레이스 링크를 그대로 열었다. 잘해야 가게 홈이라 예약을 한 번
더 눌러야 하고, 자동 발견이 물어온 URL 이 map.naver.com/p/search/… 인 사장님은 예약하려고
눌렀는데 검색 화면을 봤다. 예약하러 온 손님은 거기서 끝난다.

주소를 지어낼 필요가 없다 — 플레이스 응답의 __APOLLO_STATE__ 가 예약 주소를 직접 준다
(실측 2026-09-08, place 1273971279):
  naverBooking.naverBookingUrl = https://m.booking.naver.com/booking/6/bizes/1067685
★ bookingBusinessId + businessTypeId 로 조립하지 않는다. 조립하면 예약을 안 받는 업소에도
  주소가 생기고, 빈 화면을 본 손님은 그 가게가 예약을 안 받는 줄로 읽는다.

- LinkChannel.NAVER_BOOKING=7 (백엔드·shared·init.sql 주석)
- collector/base: RawSource.booking_url — 채널이 스스로 알려준 예약 주소
- naver_place_adapter._booking_url: ROOT_QUERY.placeDetail(...).naverBooking 에서 읽는다
- collect_service._store_booking_link: 예약 채널로 등록·자동 확정(근거는 discover_naver_place
  와 같다 — 이미 확정된 플레이스가 내놓은 자기 예약 주소다)
- site/seo/jsonld BOOKING_CHANNELS: 순서가 우선순위(예약→야놀자→여기어때→플레이스).
  화면 버튼과 makesOffer.url·potentialAction 이 같은 함수를 쓴다
- site/lib/derive: 같은 순서로 정렬 + 검색 결과 주소 배제. 문구는 bookingCtaLabel 이
  "네이버 예약으로 바로 예약하기"로 낸다("네이버 예약에서 예약"이 되지 않게)
- 빌더도 채널을 안다(useCollectFlow 라벨 · ChannelUrlInput 호스트 판정)

tsc·eslint 통과, vitest 47 passed(신규 4). 어댑터는 실제 네이버 응답으로 확인.
This commit is contained in:
HyeongBaeYang committed 2026-09-08 10:52:36 +09:00
1 parent 55ee968f9d
commit 66f81f3631
14 files changed
+235 -9

No files matched your search

@@ -1,6 +1,6 @@
import {ArrowUpRight, CalendarCheck, Phone} from 'lucide-react';
import {useSite} from '@/lib/site-context';
import {bookingLinks, bookingRows, channelLabel, sectionName} from '@/lib/derive';
import {bookingCtaLabel, bookingLinks, bookingRows, sectionName} from '@/lib/derive';
/**
* 예약 안내.
@@ -84,7 +84,7 @@ export function BookingSection() {
className="inline-flex items-center gap-1.5 rounded-xl border border-black/10 px-4 py-2.5 text-xs font-semibold transition-colors hover:bg-black/5"
style={{backgroundColor: 'var(--color-surface-alt)'}}
>
<span>{channelLabel(link)}</span>
<span>{bookingCtaLabel(link)}</span>
<ArrowUpRight className="size-3.5" />
</a>
))}
@@ -1,6 +1,6 @@
import {ArrowUpRight, BedDouble, CalendarCheck, Phone, ShieldCheck} from 'lucide-react';
import {useSite} from '@/lib/site-context';
import {channelLabel, sectionName, stayBookingView} from '@/lib/derive';
import {bookingCtaLabel, channelLabel, sectionName, stayBookingView} from '@/lib/derive';
/**
* 숙박 예약 구성 — 손님이 **이 방을 · 이 값에 · 이 창구로** 예약할 수 있는 자리.
@@ -139,7 +139,7 @@ export function StayBookingSection() {
className="flex items-center justify-between gap-2 rounded-xl border border-black/10 px-4 py-3 text-xs font-semibold transition-colors hover:bg-black/5"
style={{backgroundColor: 'var(--color-surface-alt)'}}
>
<span>{`${channelLabel(link)}에서 예약`}</span>
<span>{bookingCtaLabel(link)}</span>
<ArrowUpRight className="size-3.5 shrink-0" />
</a>
))}
@@ -12,6 +12,7 @@
import {describe, expect, it} from 'vitest';
import {
LinkChannel,
PlaceCategory,
FactStatus,
sanitizePayloadForPublish,
@@ -198,6 +199,60 @@ describe('구조화 데이터 — 예약 값이 화면과 어긋나지 않는가
});
});
describe('예약 버튼은 예약 화면으로 바로 간다', () => {
/** 네이버 예약 링크가 붙은 payload — 수집이 플레이스 응답에서 받아온 주소. */
const withBooking: SitePayload = {
...MOONLIGHT_STAY_PAYLOAD,
links: [
...MOONLIGHT_STAY_PAYLOAD.links,
{
channel: LinkChannel.NAVER_BOOKING,
url: 'https://m.booking.naver.com/booking/6/bizes/1067685',
title: undefined,
confirmed: true,
},
],
};
it('네이버 예약이 플레이스보다 먼저 나온다 — 플레이스는 한 번 더 눌러야 한다', () => {
const links = stayBookingView(withBooking)!.links;
expect(links[0].channel).toBe(LinkChannel.NAVER_BOOKING);
expect(links.map((l) => l.channel)).toContain(LinkChannel.NAVER_PLACE);
});
it('버튼 문구가 "네이버 예약에서 예약" 이 되지 않는다', () => {
const text = visibleText(html(withBooking));
expect(text).toContain('네이버 예약으로 바로 예약하기');
expect(text).not.toContain('네이버 예약에서 예약');
});
it('예약 액션과 오퍼 URL 이 예약 화면을 가리킨다 — 화면 버튼과 같은 곳이다', () => {
const [business] = collectJsonLd(withBooking, PAGE);
const action = business.potentialAction as {target: {urlTemplate: string}};
expect(action.target.urlTemplate).toBe('https://m.booking.naver.com/booking/6/bizes/1067685');
for (const offer of business.makesOffer as {url?: string}[]) {
expect(offer.url).toBe('https://m.booking.naver.com/booking/6/bizes/1067685');
}
});
it('검색 결과 주소는 예약 버튼이 되지 않는다 — 눌러도 검색 화면이다', () => {
const searchOnly: SitePayload = {
...MOONLIGHT_STAY_PAYLOAD,
links: [
{
channel: LinkChannel.NAVER_PLACE,
url: 'https://map.naver.com/p/search/%EC%8A%A4%ED%85%8C%EC%9D%B4?c=15.00,0,0,0,dh',
title: '네이버 플레이스',
confirmed: true,
},
],
};
expect(stayBookingView(searchOnly)!.links).toHaveLength(0);
// 창구가 전화뿐이라는 사실을 말해 준다 — 버튼만 조용히 사라지면 안 된다.
expect(visibleText(html(searchOnly))).toContain('온라인 예약 채널은 등록되지 않았습니다');
});
});
describe('llms.txt — AI 가 예약 경로를 읽는 자리', () => {
it('재고와 결제를 우리가 갖지 않는다고 명시한다', () => {
expect(renderLlmsTxt(MOONLIGHT_STAY_PAYLOAD)).toContain(