// reveal.jsx — 結果発表:2ページ構成(API連携版) // diagnosis prop で受け取ったDIAGNOSIS_JSON_SPEC形式のデータを表示 function RevealScreen({ diagnosis, theme, onReset, onProductTap, productSearchStart }) { const RakutenProductCard = window.RakutenProductCard; const normalizeProductList = window.normalizeProductList; const ElapsedTimer = window.ElapsedTimer; const [phase, setPhase] = React.useState(0); const [page, setPage] = React.useState("report"); const dx = diagnosis; const contentRef = React.useRef(null); React.useEffect(() => { const t1 = setTimeout(() => setPhase(1), 1400); const t2 = setTimeout(() => setPhase(2), 2600); const t3 = setTimeout(() => setPhase(3), 3400); const t4 = setTimeout(() => setPhase(4), 5000); return () => [t1, t2, t3, t4].forEach(clearTimeout); }, []); React.useEffect(() => { const stage = document.querySelector(".rv-stage"); if (stage) stage.scrollTo({ top: 0, behavior: "smooth" }); }, [page]); if (!dx || !dx.ranking) return null; const maxScore = Math.max(...dx.ranking.map((r) => r.score)); const goProducts = () => setPage("products"); const goReport = () => setPage("report"); return (
潜在意識を読み取っています
{page === "report" ? "DIAGNOSIS · あなたの潜在意識" : "RECOMMENDATION · あなたの欲しいもの"}

{(page === "report" ? "潜在意識の解析結果" : "あなたの欲しいもの").split("").map((c, i) => ( {c} ))}

{page === "report" && (
下までスクロールすると、あなたに刺さる{dx.products ? dx.products.length : 5}つの商品が見られます
PARAMETER RANKING · 潜在意識の解像
{dx.ranking.length} dimensions
0.0
0.15
0.30
{maxScore.toFixed(2)}
{dx.ranking.map((r) => { const tier = r.rank <= 3 ? "top" : r.rank <= 10 ? "mid" : "low"; const heightPct = maxScore > 0 ? (r.score / maxScore) * 100 : 0; return (
{r.score.toFixed(2)}
{String(r.rank).padStart(2, "0")}
{r.key}
); })}
Top 3 · 強く出た欲求 Mid · 補助的 Low · 弱い
CORE INSIGHT · 核心

{dx.insight.summary}

{dx.insight.headline}

{dx.topDesires.map((d, i) => (
0{i + 1} {d.label}
))}
買う理由 · WHY YOU BUY

{dx.analysis.body}

刺さりにくい · ANTI-PATTERN
    {dx.antiPatterns.items.map((it, i) => (
  • × {it}
  • ))}
)} {page === "products" && (
FROM YOUR DIAGNOSIS · 解析結果より

{dx.insight.headline}
—— その欲望に、これらが応えます。

{dx.products ? (
{normalizeProductList(dx.products).map((p, i) => ( ))}
) : dx.productError ? (

商品検索中にエラーが発生しました

{dx.productError}

) : (

楽天市場からあなたに刺さる商品を検索しています

{productSearchStart && (
検索経過時間
)}

診断結果をもとにリアルタイムで探索中です。しばらくお待ちください。

)}
)}

※ {dx.meta.note}

); } window.RevealScreen = RevealScreen;