Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/[locale]/guide/agent/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ export default async function GuideAgentPage({
<AppShell>
<article className="mx-auto max-w-3xl">
<Link
href={`/${locale}`}
href={`/${locale}${c.backLink.href}`}
prefetch={false}
className="text-sm font-medium text-emerald-700 hover:text-emerald-900"
>
{c.backHome}
{c.backLink.label}
</Link>

<header className="mt-4">
Expand Down
4 changes: 2 additions & 2 deletions app/[locale]/guide/ai-pay/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ export default async function GuideAiPayPage({
<AppShell>
<article className="mx-auto max-w-3xl">
<Link
href={`/${locale}`}
href={`/${locale}${c.backLink.href}`}
prefetch={false}
className="text-sm font-medium text-emerald-700 hover:text-emerald-900"
>
{c.backHome}
{c.backLink.label}
</Link>

<header className="mt-4">
Expand Down
7 changes: 4 additions & 3 deletions lib/agentGuide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ export type AgentGuideContent = {
readonly ctaButton: string;
readonly ctaButtonHref: string;

readonly backHome: string;
/** ページ上部のリンク。トップへはヘッダのロゴで戻れるので、文脈上の親 (/agent) を指す。 */
readonly backLink: { readonly label: string; readonly href: string };
};

const ja: AgentGuideContent = {
Expand Down Expand Up @@ -280,7 +281,7 @@ const ja: AgentGuideContent = {
ctaButton: 'AIストアを見る',
ctaButtonHref: '/discovery',

backHome: '← トップにもどる',
backLink: { label: '← OpenPay Agent', href: '/agent' },
};

const en: AgentGuideContent = {
Expand Down Expand Up @@ -446,7 +447,7 @@ const en: AgentGuideContent = {
ctaButton: 'Open the AI store',
ctaButtonHref: '/discovery',

backHome: '← Back to home',
backLink: { label: '← OpenPay Agent', href: '/agent' },
};

export const AGENT_GUIDE: Record<AgentGuideLocale, AgentGuideContent> = { ja, en };
Expand Down
7 changes: 4 additions & 3 deletions lib/aiPayGuide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ export type AiPayGuideContent = JpycSectionContent & {
readonly metaDescription: string;
readonly title: string;
readonly subtitle: string;
readonly backHome: string;
/** ページ上部のリンク。トップへはヘッダのロゴで戻れるので、文脈上の親 (/agent) を指す。 */
readonly backLink: AiPayGuideLink;

readonly mechanismTitle: string;
readonly mechanismIntro: string;
Expand Down Expand Up @@ -174,7 +175,7 @@ const ja: AiPayGuideContent = {
title: 'あなたの AI に、支払う力を。',
subtitle:
'Claude などの AI エージェントが、AI ストアのデータ・API・AI への相談を JPYC で都度購入できるようになります。数分のセットアップで、支払いは数円から。',
backHome: '← トップにもどる',
backLink: { label: '← OpenPay Agent', href: '/agent' },

mechanismTitle: '仕組み (30 秒)',
mechanismIntro:
Expand Down Expand Up @@ -292,7 +293,7 @@ const en: AiPayGuideContent = {
title: 'Give your AI the power to pay.',
subtitle:
'AI agents such as Claude can buy data, APIs, and consultations with other AIs from the AI Store, paying JPYC per use. Setup takes minutes, and purchases start at just a few yen.',
backHome: '← Back to home',
backLink: { label: '← OpenPay Agent', href: '/agent' },

mechanismTitle: 'How it works (30 seconds)',
mechanismIntro:
Expand Down
8 changes: 8 additions & 0 deletions tests/lib/agentGuide.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ describe('guideAgentMetadata: メタデータ組立', () => {

// ── (2) ja/en parity + 全 leaf 非空 ───────────────────────────────
describe('AGENT_GUIDE: ja/en 構造 parity と非空', () => {
it.each(LOCALES)('%s: 上部のリンクは文脈上の親 (/agent) を指し、ラベルは「もどる」と言わない', (loc) => {
// トップへはヘッダのロゴで戻れる。流入元は複数 (/agent・LP のモバイルオーダー節・店舗ガイド…) なので親ページの名前を出す。
const c = AGENT_GUIDE[loc];
expect(c.backLink.href).toBe('/agent');
expect(c.backLink.label).toBe('← OpenPay Agent');
expect(c.backLink.label).not.toMatch(/もどる|戻る|Back/i);
});

it('ja と en のトップレベルキーが完全一致', () => {
expect(Object.keys(AGENT_GUIDE.ja).sort()).toEqual(
Object.keys(AGENT_GUIDE.en).sort(),
Expand Down
8 changes: 8 additions & 0 deletions tests/lib/aiPayGuide.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ describe('AI_PAY_GUIDE: 主要リンク', () => {
expect(c.sdkLink.href).toBe(expected.sdk);
});

it.each(LOCALES)('%s: 上部のリンクは文脈上の親 (/agent) を指し、ラベルは「もどる」と言わない', (loc) => {
// トップへはヘッダのロゴで戻れる。流入元は複数 (/agent・AI ストア・LP…) なので「もどる」ではなく親ページの名前を出す。
const c = AI_PAY_GUIDE[loc];
expect(c.backLink.href).toBe('/agent');
expect(c.backLink.label).toBe('← OpenPay Agent');
expect(c.backLink.label).not.toMatch(/もどる|戻る|Back/i);
});

it.each(LOCALES)('%s: discovery と売り手ガイドの内部リンクが正しい', (loc) => {
const c = AI_PAY_GUIDE[loc];
expect(c.ctaButtonHref).toBe('/discovery');
Expand Down
Loading