Mobile Paywall
A phone paywall selects a plan and shows a Welcome to Pro confirmation.
Source
components/kuchi/mobile-paywall.tsx
1"use client";23import { loadFont } from "@remotion/google-fonts/Figtree";4import type React from "react";5import {6 AbsoluteFill,7 Easing,8 interpolate,9 spring,10 useCurrentFrame,11 useVideoConfig,12} from "remotion";13import type { GradientParams } from "@/lib/kuchi/gsh/gradient-engine";14import { GshGround } from "@/lib/kuchi/gsh/gsh-ground";15import type { GshPresetId } from "@/lib/kuchi/gsh/presets";1617const figtree = loadFont("normal", {18 weights: ["300", "400"],19 subsets: ["latin"],20});2122export type PaywallIcon = "grid" | "film" | "palette" | "bolt";2324export interface PaywallFeature {25 title: string;26 description: string;27 icon?: PaywallIcon;28}2930export interface PaywallPlan {31 label: string;32 price: string;33 detail: string;34 /** Shown after "7 days free, then …" when the plan is selected. */35 renews: string;36 badge?: string;37}3839export interface MobilePaywallProps {40 appName?: string;41 title?: string;42 features?: PaywallFeature[];43 /** Two plans: the first is the one that gets tapped, the second starts selected. */44 plans?: [PaywallPlan, PaywallPlan];45 cta?: string;46 account?: string;47 /** Trial dates on the confirmation: start, reminder, first charge. */48 dates?: [string, string, string];49 /** Three lines beside the phone: paywall, confirm, welcome. */50 lines?: [string, string, string];51 /** Heading on the welcome screen after the purchase. */52 welcomeTitle?: string;53 /** Line under the welcome heading. */54 welcomeSub?: string;55 /** Button on the welcome screen. */56 welcomeCta?: string;57 accent?: string;58 /** Color of the lines beside the phone; overrides the theme. */59 ink?: string;60 /** Solid fill in place of the gradient ground; "transparent" drops it. */61 background?: string;62 /** Typeface for the copy. Load it yourself; Figtree by default. */63 fontFamily?: string;64 /** Replaces the acme mark on the app icon. */65 logo?: React.ReactNode;66 /** Size of the phone and lines, around the frame's center. */67 scale?: number;68 /** Frames to hold the first frame before anything moves. */69 delay?: number;70 speed?: number;71 theme?: "light" | "dark";72 ground?: GshPresetId;73 groundParams?: Partial<GradientParams>;74}7576const DEFAULT_FEATURES: PaywallFeature[] = [77 {78 title: "Every component, unlocked",79 description: "200+ animations, transitions and scenes",80 icon: "grid",81 },82 {83 title: "4K, 60fps export",84 description: "Crisp launch videos for every channel",85 icon: "film",86 },87 {88 title: "Brand kits",89 description: "Your fonts, colors and logo, everywhere",90 icon: "palette",91 },92 {93 title: "Priority renders",94 description: "Skip the queue on every export",95 icon: "bolt",96 },97];9899const DEFAULT_PLANS: [PaywallPlan, PaywallPlan] = [100 {101 label: "Yearly",102 price: "$59.99/yr",103 detail: "$5.00/mo, billed yearly",104 renews: "$59.99/year",105 badge: "Save 37%",106 },107 {108 label: "Monthly",109 price: "$7.99/mo",110 detail: "Billed monthly",111 renews: "$7.99/month",112 },113];114115const ICONS: Record<PaywallIcon, string> = {116 grid: "M4 4h7v7H4zM13 4h7v7h-7zM4 13h7v7H4zM13 13h7v7h-7z",117 film: "M3 5h18v14H3zM7 5v14M17 5v14M3 9.5h4M3 14.5h4M17 9.5h4M17 14.5h4",118 palette:119 "M12 3a9 9 0 100 18c1 0 1.5-.7 1.5-1.5 0-.9-.7-1.2-.7-2 0-.8.7-1.5 1.5-1.5H17a4 4 0 004-4c0-5-4-9-9-9zM7.5 11.5h.01M10.5 7.5h.01M15 7.5h.01",120 bolt: "M13 2L4 14h7l-1 8 9-12h-7z",121};122123124const SW = 393;125const SH = 852;126const BEZEL = 11;127const BW = SW + BEZEL * 2;128const BH = SH + BEZEL * 2;129const SHEET_TOP = 58;130const PAD = 22;131const CW = SW - PAD * 2;132const CARD_W = (CW - 10) / 2;133const PLANS_Y = 562;134const CTA_Y = 694;135136const SHEET_AT = 4;137const TAP_IN = 50;138const TAP1 = 66;139const TAP2 = 100;140const PAY_AT = 108;141const DC1 = 138;142const DC2 = 146;143const CHECK_AT = 156;144const DISMISS = 180;145const WELCOME = 186;146147const clamp = { extrapolateLeft: "clamp", extrapolateRight: "clamp" } as const;148const ENTER = Easing.bezier(0.32, 0.72, 0, 1);149const LIGHT = Easing.bezier(0.22, 1, 0.36, 1);150const MOVE = Easing.bezier(0.65, 0, 0.35, 1);151const EXIT = Easing.bezier(0.55, 0, 1, 0.45);152const CAMERA = Easing.bezier(0.87, 0, 0.13, 1);153const HEAVY = { mass: 1, damping: 26, stiffness: 120 };154const CARD = { mass: 0.8, damping: 18, stiffness: 160 };155const CHIP = { mass: 0.5, damping: 12, stiffness: 200 };156const MORPH = { damping: 200 };157158const LIGHT_PAL = {159 sheet: "#ffffff",160 behind: "#c8c8ce",161 text: "#121215",162 muted: "#6c6c74",163 ring: "rgba(18,18,21,0.1)",164 hair: "rgba(18,18,21,0.08)",165 chip: "#f2f2f4",166 ctaBg: "#121215",167 ctaText: "#ffffff",168 pay: "#ffffff",169 copy: "#121215",170 frame:171 "linear-gradient(155deg,#f1f1f3 0%,#c4c4ca 30%,#e2e2e6 62%,#b3b3ba 100%)",172 shadow:173 "0 50px 90px -24px rgba(30,32,44,0.32), 0 14px 30px -10px rgba(30,32,44,0.18)",174 dark: false,175};176const DARK_PAL: typeof LIGHT_PAL = {177 sheet: "#0d0d10",178 behind: "#2a2a2f",179 text: "#f4f4f6",180 muted: "#8d8d96",181 ring: "rgba(255,255,255,0.12)",182 hair: "rgba(255,255,255,0.08)",183 chip: "#1c1c20",184 ctaBg: "#f4f4f6",185 ctaText: "#111113",186 pay: "#1a1a1d",187 copy: "#f4f4f6",188 frame:189 "linear-gradient(155deg,#55565c 0%,#2a2b2f 30%,#3d3e43 62%,#1f2023 100%)",190 shadow:191 "0 50px 100px -20px rgba(0,0,0,0.7), 0 18px 36px -12px rgba(0,0,0,0.5)",192 dark: true,193};194type Palette = typeof LIGHT_PAL;195196function withAlpha(hex: string, alpha: number) {197 const h = hex.replace("#", "");198 const full = h.length === 3 ? h.replace(/./g, (x) => x + x) : h.slice(0, 6);199 const n = Number.parseInt(full, 16);200 return `rgba(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255}, ${alpha})`;201}202203function Glyph({204 d,205 size = 18,206 color,207 sw = 1.5,208}: {209 d: string;210 size?: number;211 color: string;212 sw?: number;213}) {214 return (215 <svg width={size} height={size} viewBox="0 0 24 24" fill="none">216 <path217 d={d}218 stroke={color}219 strokeWidth={sw}220 strokeLinecap="round"221 strokeLinejoin="round"222 />223 </svg>224 );225}226227function AppTile({228 size,229 accent,230 logo,231}: {232 size: number;233 accent: string;234 logo?: React.ReactNode;235}) {236 return (237 <div238 style={{239 width: size,240 height: size,241 borderRadius: size * 0.24,242 background: accent,243 boxShadow: `inset 0 0 0 0.5px rgba(255,255,255,0.22), inset 0 1px 0 rgba(255,255,255,0.2), 0 ${size * 0.12}px ${size * 0.3}px -${size * 0.08}px rgba(0,0,0,0.3)`,244 display: "flex",245 alignItems: "center",246 justifyContent: "center",247 flexShrink: 0,248 }}249 >250 {logo ?? (251 <svg viewBox="0 0 124.06 134.26" height={size * 0.42} aria-hidden>252 <circle cx="62.03" cy="67.13" r="56" fill="#fff" />253 </svg>254 )}255 </div>256 );257}258259function StatusBar({ color }: { color: string }) {260 return (261 <div262 style={{263 position: "absolute",264 top: 0,265 left: 0,266 right: 0,267 height: 54,268 display: "flex",269 alignItems: "center",270 justifyContent: "space-between",271 padding: "6px 30px 0 34px",272 zIndex: 8,273 }}274 >275 <span276 style={{277 fontSize: 17,278 color,279 width: 54,280 textAlign: "center",281 }}282 >283 9:41284 </span>285 <div style={{ display: "flex", gap: 7, alignItems: "center" }}>286 <svg width="18" height="12" viewBox="0 0 18 12">287 {[0, 1, 2, 3].map((i) => (288 <rect289 key={i}290 x={i * 4.6}291 y={9 - i * 3}292 width={3.2}293 height={3 + i * 3}294 rx={0.8}295 fill={color}296 />297 ))}298 </svg>299 <svg width="16" height="12" viewBox="0 0 16 12">300 <path301 d="M8 11.2l2.3-2.6a3.3 3.3 0 00-4.6 0zM3.6 6.4a6.3 6.3 0 018.8 0l1.4-1.6a8.4 8.4 0 00-11.6 0zM.6 3.1a10.6 10.6 0 0114.8 0L16.8 1.5a12.7 12.7 0 00-17.6 0z"302 fill={color}303 />304 </svg>305 <div306 style={{307 width: 25,308 height: 12,309 borderRadius: 3.5,310 border: `1px solid ${color}`,311 padding: 1.5,312 boxSizing: "border-box",313 }}314 >315 <div316 style={{317 width: "78%",318 height: "100%",319 borderRadius: 2,320 background: color,321 }}322 />323 </div>324 </div>325 </div>326 );327}328329function Phone({330 children,331 sidePress,332 c,333}: {334 children: React.ReactNode;335 sidePress: number;336 c: Palette;337}) {338 const btn = (side: "left" | "right", top: number, h: number, dx = 0) => (339 <div340 style={{341 position: "absolute",342 [side]: -3 + dx,343 top,344 width: 4,345 height: h,346 borderRadius: 2,347 background: c.frame,348 }}349 />350 );351 return (352 <div style={{ position: "relative", width: BW, height: BH }}>353 {btn("left", 150, 32)}354 {btn("left", 210, 62)}355 {btn("left", 284, 62)}356 {btn("right", 236, 98, sidePress * 1.6)}357 <div358 style={{359 position: "absolute",360 inset: 0,361 borderRadius: 68,362 background: c.frame,363 boxShadow: `${c.shadow}, inset 0 0 0 1px rgba(255,255,255,0.22)`,364 }}365 />366 <div367 style={{368 position: "absolute",369 inset: 3.5,370 borderRadius: 64.5,371 background: "#050506",372 }}373 />374 <div375 style={{376 position: "absolute",377 left: BEZEL,378 top: BEZEL,379 width: SW,380 height: SH,381 borderRadius: 56,382 overflow: "hidden",383 background: "#000",384 }}385 >386 {children}387 <div388 style={{389 position: "absolute",390 top: 11,391 left: (SW - 126) / 2,392 width: 126,393 height: 37,394 borderRadius: 19,395 background: "#000",396 zIndex: 20,397 }}398 />399 </div>400 </div>401 );402}403404function Radio({ on, accent, c }: { on: number; accent: string; c: Palette }) {405 return (406 <div407 style={{408 width: 22,409 height: 22,410 borderRadius: 11,411 boxShadow: `inset 0 0 0 1.5px ${c.ring}`,412 display: "flex",413 alignItems: "center",414 justifyContent: "center",415 }}416 >417 <div418 style={{419 width: 22,420 height: 22,421 borderRadius: 11,422 background: accent,423 transform: `scale(${on})`,424 display: "flex",425 alignItems: "center",426 justifyContent: "center",427 }}428 >429 <Glyph d="M6 12.5l4 4 8-9" size={14} color="#fff" sw={2} />430 </div>431 </div>432 );433}434435/** The foreground at `scale`, around the frame's center; nothing extra at 1. */436function ScaleLayer({437 scale,438 children,439}: {440 scale: number;441 children: React.ReactNode;442}) {443 if (scale === 1) return children;444 return (445 <AbsoluteFill style={{ transform: `scale(${scale})` }}>446 {children}447 </AbsoluteFill>448 );449}450451export function MobilePaywall({452 appName = "acme Pro",453 title = "Ship launch videos in minutes",454 features = DEFAULT_FEATURES,455 plans = DEFAULT_PLANS,456 cta = "Start free for 7 days",457 account = "maya@kitebase.dev",458 dates = ["Nov 2", "Nov 7", "Nov 9"],459 lines = [460 "Pro, one tap away.",461 "Double-click to confirm.",462 "Seven days, on us.",463 ],464 welcomeTitle = "Welcome to Pro",465 welcomeSub = "Your free week starts now. Here’s how it works.",466 welcomeCta = "Start creating",467 accent = "#3B5BFD",468 ink,469 background,470 fontFamily = figtree.fontFamily,471 logo,472 scale = 1,473 delay = 0,474 speed = 1,475 theme = "light",476 ground,477 groundParams,478}: MobilePaywallProps) {479 const frame = Math.max(0, useCurrentFrame() - delay);480 const { fps, width, height } = useVideoConfig();481 const f = frame * speed;482 const c = theme === "dark" ? DARK_PAL : LIGHT_PAL;483 const fg = ink ?? c.copy;484 const tall = height > width;485 const W = tall ? 720 : 1280;486 const H = tall ? 1280 : 720;487 const u = Math.min(width / W, height / H);488 const k = tall ? (H * 0.74) / BH : (H * 0.94) / BH;489 const phoneCx = tall ? W / 2 : W * 0.665;490 const phoneCy = tall ? H - 36 - (BH * k) / 2 : H / 2;491492 const sp = (at: number, config: typeof CARD | typeof MORPH = CARD) =>493 spring({ frame: f - at, fps, config });494 const pressAt = (at: number) =>495 spring({ frame: f - at, fps, config: CHIP }) -496 spring({ frame: f - at - 4, fps, config: CHIP });497498 const rise = spring({ frame: f, fps, config: HEAVY });499 const sheetIn = sp(SHEET_AT, HEAVY);500 const hero = sp(10, CHIP);501 const titleIn = interpolate(f, [12, 26], [0, 1], { ...clamp, easing: ENTER });502 const featIn = features.map((_, i) => sp(16 + i * 3));503 const plansIn = [sp(26), sp(29)];504 const ctaIn = sp(32);505506 const sel = sp(TAP1 + 1, MORPH);507 const ctaPress = pressAt(TAP2);508509 const keys = [510 { t: TAP_IN, x: 300, y: 800 },511 { t: TAP1 - 1, x: PAD + CARD_W / 2, y: PLANS_Y + 50 },512 { t: TAP1 + 10, x: PAD + CARD_W / 2 + 6, y: PLANS_Y + 56 },513 { t: TAP2 - 1, x: SW / 2, y: CTA_Y + 28 },514 ];515 let tap = { x: keys[0].x, y: keys[0].y };516 for (let i = 0; i < keys.length - 1; i++) {517 const a = keys[i];518 const b = keys[i + 1];519 if (f >= a.t) {520 const e = MOVE(Math.min(1, Math.max(0, (f - a.t) / (b.t - a.t))));521 const dist = Math.hypot(b.x - a.x, b.y - a.y);522 const lift = Math.sin(Math.PI * e) * Math.min(36, dist * 0.2);523 const nx = dist ? -(b.y - a.y) / dist : 0;524 const ny = dist ? (b.x - a.x) / dist : 0;525 tap = {526 x: a.x + (b.x - a.x) * e + nx * lift,527 y: a.y + (b.y - a.y) * e + ny * lift,528 };529 }530 }531 const tapOpacity = interpolate(532 f,533 [TAP_IN, TAP_IN + 6, TAP2 + 6, TAP2 + 11],534 [0, 1, 1, 0],535 clamp,536 );537 const tapScale = 1 - 0.14 * Math.max(pressAt(TAP1), pressAt(TAP2));538539 const pay = sp(PAY_AT, HEAVY);540 const away = spring({541 frame: f - DISMISS,542 fps,543 config: MORPH,544 durationInFrames: 14,545 });546 const sidePress = Math.max(pressAt(DC1), pressAt(DC2));547 const hintOn = f >= PAY_AT + 8 && f < DC2 + 5;548 const hintPulse = hintOn ? 0.55 + 0.45 * Math.sin((f - PAY_AT) / 3.2) : 0;549 const hintIn = spring({ frame: f - PAY_AT - 8, fps, config: CARD });550 const processing = f >= DC2 + 2 && f < CHECK_AT;551 const check = interpolate(f, [CHECK_AT, CHECK_AT + 14], [0, 1], {552 ...clamp,553 easing: LIGHT,554 });555 const done = f >= CHECK_AT;556557 const out = interpolate(f, [DISMISS, DISMISS + 8], [1, 0], {558 ...clamp,559 easing: EXIT,560 });561 const wIcon = sp(WELCOME);562 const wBadge = sp(WELCOME + 8, CHIP);563 const wTitle = interpolate(f, [WELCOME + 4, WELCOME + 18], [0, 1], {564 ...clamp,565 easing: ENTER,566 });567 const wSub = interpolate(f, [WELCOME + 7, WELCOME + 21], [0, 1], {568 ...clamp,569 easing: ENTER,570 });571 const wRows = [0, 1, 2].map((i) => sp(WELCOME + 10 + i * 4));572 const wRail = interpolate(f, [WELCOME + 12, WELCOME + 30], [0, 1], {573 ...clamp,574 easing: MOVE,575 });576 const wCta = sp(WELCOME + 16);577 const camera = interpolate(f, [0, 250], [1, 1.035], {578 ...clamp,579 easing: CAMERA,580 });581582 const enter = (v: number, dy = 10): React.CSSProperties => ({583 opacity: Math.min(1, v * 1.4),584 transform: `translateY(${(1 - v) * dy}px)`,585 });586 const abs = (top: number): React.CSSProperties => ({587 position: "absolute",588 left: PAD,589 width: CW,590 top: top - SHEET_TOP,591 });592593 const beats = [0, PAY_AT, WELCOME];594 const copyLine = (i: number) => {595 const inAt = beats[i] + (i === 0 ? 8 : 0);596 const outAt = beats[i + 1];597 const pin = interpolate(f, [inAt, inAt + 14], [0, 1], {598 ...clamp,599 easing: ENTER,600 });601 const pout =602 outAt === undefined603 ? 0604 : interpolate(f, [outAt - 2, outAt + 6], [0, 1], {605 ...clamp,606 easing: EXIT,607 });608 if (pin <= 0 || pout >= 1) return null;609 return (610 <div611 key={i}612 style={{613 position: "absolute",614 left: 0,615 right: 0,616 top: 0,617 transform: `translateY(${(1 - pin) * 70 - pout * 50}%)`,618 opacity: pin * (1 - pout),619 }}620 >621 {lines[i]}622 </div>623 );624 };625626 const timeline: [string, string, string][] = [627 [dates[0], "Today", "Every Pro feature is unlocked"],628 [dates[1], "Reminder", "We’ll nudge you two days before"],629 [dates[2], "Trial ends", `Billed ${plans[0].renews}, cancel anytime`],630 ];631632 return (633 <AbsoluteFill style={{ fontFamily, overflow: "hidden" }}>634 {background === undefined ? (635 <>636 <GshGround637 preset={ground ?? (c.dark ? "flood" : "glasswork")}638 params={639 groundParams ??640 (c.dark || ground641 ? undefined642 : { colors: ["#a9bbff", "#3552ff", "#1a2a9e", "#7f9bff"] })643 }644 timeOffset={c.dark ? 3 : 8}645 timeScale={0.35}646 />647 <AbsoluteFill648 style={{649 background: c.dark ? "rgba(2,3,8,0.25)" : "rgba(240,241,245,0.3)",650 }}651 />652 </>653 ) : (654 <AbsoluteFill655 style={{656 background: background === "transparent" ? undefined : background,657 }}658 />659 )}660 <ScaleLayer scale={scale}>661 <div662 style={{663 position: "absolute",664 left: (width - W * u) / 2,665 top: (height - H * u) / 2,666 width: W,667 height: H,668 transformOrigin: "0 0",669 transform: `scale(${u})`,670 }}671 >672 <div673 style={{674 position: "absolute",675 left: tall ? 56 : 92,676 top: tall ? 88 : H / 2 - 80,677 width: tall ? W - 112 : 500,678 height: 160,679 fontSize: tall ? 60 : 72,680 fontWeight: 300,681 lineHeight: 1.04,682 letterSpacing: "-0.035em",683 color: fg,684 overflow: "hidden",685 textWrap: "balance",686 }}687 >688 {[0, 1, 2].map((i) => copyLine(i))}689 </div>690 <div691 style={{692 position: "absolute",693 left: phoneCx - BW / 2,694 top: phoneCy - BH / 2,695 width: BW,696 height: BH,697 transform: `translateY(${(1 - rise) * H * 0.9}px) scale(${k * camera})`,698 }}699 >700 <Phone sidePress={sidePress} c={c}>701 <StatusBar color="#fff" />702 <div703 style={{704 position: "absolute",705 top: 47,706 left: 14,707 right: 14,708 height: 60,709 borderRadius: 12,710 background: c.behind,711 opacity: sheetIn,712 }}713 />714 <div715 style={{716 position: "absolute",717 left: 0,718 right: 0,719 top: SHEET_TOP,720 bottom: 0,721 borderRadius: "14px 14px 0 0",722 background: c.sheet,723 color: c.text,724 overflow: "hidden",725 transform: `translateY(${(1 - sheetIn) * SH}px)`,726 }}727 >728 <div729 style={{730 position: "absolute",731 inset: 0,732 opacity: out,733 transform: `scale(${0.96 + out * 0.04})`,734 }}735 >736 <div737 style={{738 ...abs(74),739 display: "flex",740 justifyContent: "space-between",741 alignItems: "center",742 }}743 >744 <div745 style={{746 width: 32,747 height: 32,748 borderRadius: 16,749 background: c.chip,750 display: "flex",751 alignItems: "center",752 justifyContent: "center",753 }}754 >755 <Glyph756 d="M7 7l10 10M17 7L7 17"757 size={15}758 color={c.muted}759 sw={2}760 />761 </div>762 <span style={{ fontSize: 15, color: c.muted }}>763 Restore764 </span>765 </div>766 <div767 style={{768 ...abs(112),769 display: "flex",770 opacity: Math.min(1, hero * 1.5),771 transform: `scale(${0.8 + hero * 0.2})`,772 transformOrigin: "0 50%",773 }}774 >775 <AppTile size={64} accent={accent} logo={logo} />776 </div>777 <div778 style={{779 ...abs(196),780 fontSize: 34,781 fontWeight: 300,782 letterSpacing: "-0.035em",783 lineHeight: 1.08,784 textWrap: "balance",785 paddingRight: 30,786 boxSizing: "border-box",787 ...enter(titleIn, 16),788 }}789 >790 {title}791 </div>792 <div793 style={{794 ...abs(298),795 height: 1,796 background: c.hair,797 opacity: featIn[0],798 }}799 />800 {features.slice(0, 4).map((ft, i) => (801 <div802 key={ft.title}803 style={{804 ...abs(316 + i * 52),805 display: "flex",806 alignItems: "center",807 gap: 14,808 fontSize: 17,809 ...enter(featIn[i], 12),810 }}811 >812 <Glyph813 d={ICONS[ft.icon ?? "grid"]}814 size={22}815 color={c.text}816 />817 {ft.title}818 </div>819 ))}820 {plans.map((pl, i) => {821 const on = i === 0 ? sel : 1 - sel;822 const press = i === 0 ? pressAt(TAP1) : 0;823 return (824 <div825 key={pl.label}826 style={{827 position: "absolute",828 left: PAD + i * (CARD_W + 10),829 top: PLANS_Y - SHEET_TOP,830 width: CARD_W,831 height: 96,832 borderRadius: 16,833 background: withAlpha(834 accent,835 (c.dark ? 0.12 : 0.05) * on,836 ),837 boxShadow: `inset 0 0 0 ${1 + on * 0.5}px ${on > 0.5 ? accent : c.ring}`,838 padding: "16px 14px",839 boxSizing: "border-box",840 fontVariantNumeric: "tabular-nums",841 opacity: Math.min(1, plansIn[i] * 1.4),842 transform: `translateY(${(1 - plansIn[i]) * 16}px) scale(${1 - press * 0.04})`,843 }}844 >845 {pl.badge ? (846 <div847 style={{848 position: "absolute",849 top: -10,850 right: 12,851 height: 20,852 padding: "0 7px",853 borderRadius: 6,854 background: on > 0.5 ? accent : c.text,855 color: on > 0.5 ? "#fff" : c.sheet,856 fontSize: 13,857 lineHeight: "20px",858 }}859 >860 {pl.badge}861 </div>862 ) : null}863 <div864 style={{ position: "absolute", right: 12, top: 16 }}865 >866 <Radio on={on} accent={accent} c={c} />867 </div>868 <div style={{ fontSize: 15, color: c.muted }}>869 {pl.label}870 </div>871 <div872 style={{873 fontSize: 22,874 fontWeight: 300,875 letterSpacing: "-0.02em",876 marginTop: 4,877 }}878 >879 {pl.price}880 </div>881 <div882 style={{ fontSize: 13, color: c.muted, marginTop: 2 }}883 >884 {pl.detail}885 </div>886 </div>887 );888 })}889 <div890 style={{891 ...abs(668),892 height: 18,893 fontSize: 14,894 color: c.muted,895 textAlign: "center",896 opacity: Math.min(1, ctaIn * 1.4),897 }}898 >899 {plans.map((pl, i) => {900 const o = i === 0 ? sel : 1 - sel;901 return (902 <div903 key={pl.label}904 style={{905 position: "absolute",906 inset: 0,907 opacity: o,908 transform: `translateY(${(1 - o) * (i === 0 ? 8 : -8)}px)`,909 }}910 >911 7 days free, then{" "}912 <span style={{ color: c.text }}>{pl.renews}</span>913 </div>914 );915 })}916 </div>917 <div918 style={{919 ...abs(CTA_Y),920 height: 56,921 borderRadius: 28,922 background: c.ctaBg,923 color: c.ctaText,924 fontSize: 17,925 display: "flex",926 alignItems: "center",927 justifyContent: "center",928 opacity: Math.min(1, ctaIn * 1.4),929 transform: `translateY(${(1 - ctaIn) * 16}px) scale(${1 - ctaPress * 0.04})`,930 }}931 >932 {cta}933 </div>934 <div935 style={{936 ...abs(764),937 textAlign: "center",938 fontSize: 14,939 color: c.muted,940 opacity: ctaIn,941 }}942 >943 Cancel anytime · Terms · Privacy944 </div>945 </div>946947 {f >= WELCOME - 2 ? (948 <div style={{ position: "absolute", inset: 0 }}>949 <div950 style={{951 ...abs(164),952 opacity: Math.min(1, wIcon * 1.5),953 transform: `scale(${0.85 + wIcon * 0.15})`,954 transformOrigin: "0 50%",955 }}956 >957 <div style={{ position: "relative", width: 72 }}>958 <AppTile size={72} accent={accent} logo={logo} />959 <div960 style={{961 position: "absolute",962 right: -8,963 bottom: -8,964 width: 30,965 height: 30,966 borderRadius: 15,967 background: "#1f9d55",968 boxShadow: `0 0 0 3px ${c.sheet}`,969 display: "flex",970 alignItems: "center",971 justifyContent: "center",972 transform: `scale(${wBadge})`,973 }}974 >975 <Glyph976 d="M6 12.5l4 4 8-9"977 size={16}978 color="#fff"979 sw={2}980 />981 </div>982 </div>983 </div>984 <div985 style={{986 ...abs(266),987 fontSize: 34,988 fontWeight: 300,989 letterSpacing: "-0.035em",990 ...enter(wTitle, 16),991 }}992 >993 {welcomeTitle}994 </div>995 <div996 style={{997 ...abs(312),998 fontSize: 16,999 lineHeight: 1.4,1000 color: c.muted,1001 textWrap: "pretty",1002 ...enter(wSub, 12),1003 }}1004 >1005 {welcomeSub}1006 </div>1007 <div1008 style={{1009 position: "absolute",1010 left: PAD + 10.25,1011 top: 412 - SHEET_TOP,1012 width: 1.5,1013 height: 148 * wRail,1014 background: `linear-gradient(${accent}, ${c.hair})`,1015 }}1016 />1017 {timeline.map(([date, head, body], i) => (1018 <div1019 key={head}1020 style={{1021 ...abs(400 + i * 74),1022 display: "flex",1023 gap: 16,1024 ...enter(wRows[i], 14),1025 }}1026 >1027 <div1028 style={{1029 width: 22,1030 height: 22,1031 borderRadius: 11,1032 flexShrink: 0,1033 background: i === 0 ? accent : c.sheet,1034 boxShadow:1035 i === 0 ? "none" : `inset 0 0 0 1.5px ${c.ring}`,1036 display: "flex",1037 alignItems: "center",1038 justifyContent: "center",1039 marginTop: 1,1040 }}1041 >1042 {i === 0 ? (1043 <Glyph1044 d="M6 12.5l4 4 8-9"1045 size={13}1046 color="#fff"1047 sw={2}1048 />1049 ) : null}1050 </div>1051 <div style={{ flex: 1 }}>1052 <div1053 style={{1054 display: "flex",1055 justifyContent: "space-between",1056 fontSize: 17,1057 }}1058 >1059 {head}1060 <span1061 style={{1062 fontSize: 15,1063 color: c.muted,1064 fontVariantNumeric: "tabular-nums",1065 }}1066 >1067 {date}1068 </span>1069 </div>1070 <div1071 style={{1072 fontSize: 15,1073 color: c.muted,1074 marginTop: 3,1075 }}1076 >1077 {body}1078 </div>1079 </div>1080 </div>1081 ))}1082 <div1083 style={{1084 ...abs(CTA_Y),1085 height: 56,1086 borderRadius: 28,1087 background: accent,1088 color: "#fff",1089 fontSize: 17,1090 display: "flex",1091 alignItems: "center",1092 justifyContent: "center",1093 ...enter(wCta, 24),1094 }}1095 >1096 {welcomeCta}1097 </div>1098 </div>1099 ) : null}1100 </div>11011102 <div1103 style={{1104 position: "absolute",1105 inset: 0,1106 background: "#000",1107 opacity: 0.5 * Math.max(0, pay - away),1108 zIndex: 10,1109 }}1110 />1111 {hintOn ? (1112 <div1113 style={{1114 position: "absolute",1115 right: 0,1116 top: 225,1117 height: 98,1118 zIndex: 12,1119 display: "flex",1120 alignItems: "center",1121 gap: 14,1122 padding: "0 10px 0 18px",1123 borderRadius: "22px 0 0 22px",1124 background: "rgba(28,28,30,0.94)",1125 boxShadow:1126 "inset 0 0 0 0.5px rgba(255,255,255,0.12), 0 8px 24px rgba(0,0,0,0.35)",1127 opacity:1128 Math.min(1, hintIn * 1.5) *1129 interpolate(f, [DC2, DC2 + 5], [1, 0], {1130 ...clamp,1131 easing: EXIT,1132 }),1133 transform: `translateX(${(1 - hintIn) * 40}px)`,1134 }}1135 >1136 <div1137 style={{1138 textAlign: "right",1139 color: "#fff",1140 fontSize: 15,1141 lineHeight: 1.3,1142 }}1143 >1144 Double Click1145 <br />1146 to Subscribe1147 </div>1148 <div1149 style={{1150 width: 4,1151 height: 74,1152 borderRadius: 2,1153 background: "#fff",1154 opacity: 0.35 + hintPulse * 0.65,1155 transform: `translateX(${sidePress * 2}px)`,1156 }}1157 />1158 </div>1159 ) : null}1160 <div1161 style={{1162 position: "absolute",1163 left: 8,1164 right: 8,1165 bottom: 8,1166 height: 404,1167 borderRadius: 48,1168 background: c.pay,1169 fontVariantNumeric: "tabular-nums",1170 color: c.text,1171 zIndex: 11,1172 padding: "22px 24px",1173 boxSizing: "border-box",1174 transform: `translateY(${(1 - pay) * 430 + away * 440}px)`,1175 boxShadow: c.dark1176 ? "inset 0 1px 0 rgba(255,255,255,0.06)"1177 : "0 -4px 30px rgba(0,0,0,0.16)",1178 opacity: f >= PAY_AT ? 1 : 0,1179 }}1180 >1181 <div style={{ display: "flex", alignItems: "center", gap: 12 }}>1182 <AppTile size={44} accent={accent} logo={logo} />1183 <div style={{ flex: 1 }}>1184 <div style={{ fontSize: 17 }}>{appName}</div>1185 <div style={{ fontSize: 14, color: c.muted, marginTop: 1 }}>1186 {plans[0].label} subscription1187 </div>1188 </div>1189 <div1190 style={{1191 width: 30,1192 height: 30,1193 borderRadius: 15,1194 background: c.chip,1195 display: "flex",1196 alignItems: "center",1197 justifyContent: "center",1198 }}1199 >1200 <Glyph1201 d="M7 7l10 10M17 7L7 17"1202 size={13}1203 color={c.muted}1204 sw={2}1205 />1206 </div>1207 </div>1208 <div style={{ marginTop: 16 }}>1209 {[1210 ["Free trial", "7 days"],1211 ["Then", plans[0].renews],1212 ["First charge", `${dates[2]}, 2026`],1213 ["Account", account],1214 ].map(([kk, v]) => (1215 <div1216 key={kk}1217 style={{1218 display: "flex",1219 justifyContent: "space-between",1220 alignItems: "center",1221 height: 42,1222 boxShadow: `inset 0 1px 0 ${c.hair}`,1223 fontSize: 15,1224 }}1225 >1226 <span style={{ color: c.muted }}>{kk}</span>1227 <span>{v}</span>1228 </div>1229 ))}1230 </div>1231 <div1232 style={{1233 position: "absolute",1234 left: 0,1235 right: 0,1236 bottom: 30,1237 display: "flex",1238 flexDirection: "column",1239 alignItems: "center",1240 gap: 10,1241 }}1242 >1243 <div style={{ position: "relative", width: 50, height: 50 }}>1244 {done ? (1245 <svg width={50} height={50} viewBox="0 0 50 50">1246 <circle1247 cx={25}1248 cy={25}1249 r={22}1250 fill="none"1251 stroke={accent}1252 strokeWidth={2}1253 pathLength={1}1254 strokeDasharray={1}1255 strokeDashoffset={1 - check}1256 transform="rotate(-90 25 25)"1257 />1258 <path1259 d="M15 25.5l7 7 13-14"1260 fill="none"1261 stroke={accent}1262 strokeWidth={2.4}1263 strokeLinecap="round"1264 strokeLinejoin="round"1265 pathLength={1}1266 strokeDasharray={1}1267 strokeDashoffset={1268 1 - interpolate(check, [0.4, 1], [0, 1], clamp)1269 }1270 />1271 </svg>1272 ) : processing ? (1273 <svg1274 width={50}1275 height={50}1276 viewBox="0 0 50 50"1277 style={{ transform: `rotate(${f * 14}deg)` }}1278 >1279 <circle1280 cx={25}1281 cy={25}1282 r={20}1283 fill="none"1284 stroke={c.hair}1285 strokeWidth={2.5}1286 />1287 <circle1288 cx={25}1289 cy={25}1290 r={20}1291 fill="none"1292 stroke={accent}1293 strokeWidth={2.5}1294 strokeLinecap="round"1295 strokeDasharray="34 200"1296 />1297 </svg>1298 ) : (1299 <svg width={50} height={50} viewBox="0 0 50 50">1300 <rect1301 x={14}1302 y={6}1303 width={20}1304 height={38}1305 rx={6}1306 fill="none"1307 stroke={c.text}1308 strokeWidth={1.5}1309 />1310 <rect1311 x={35 + sidePress * -1.5}1312 y={14}1313 width={3.5}1314 height={11}1315 rx={1.5}1316 fill={accent}1317 opacity={0.5 + hintPulse * 0.5}1318 />1319 </svg>1320 )}1321 </div>1322 <div style={{ fontSize: 15 }}>1323 {done1324 ? "Done"1325 : processing1326 ? "Processing…"1327 : "Confirm with side button"}1328 </div>1329 </div>1330 </div>1331 <div1332 style={{1333 position: "absolute",1334 left: tap.x - 22,1335 top: tap.y - 22,1336 width: 44,1337 height: 44,1338 borderRadius: 22,1339 background: "rgba(40,40,48,0.24)",1340 boxShadow:1341 "inset 0 0 0 1.5px rgba(255,255,255,0.85), 0 4px 14px rgba(0,0,0,0.22)",1342 opacity: tapOpacity,1343 transform: `scale(${tapScale})`,1344 zIndex: 15,1345 }}1346 />1347 <div1348 style={{1349 position: "absolute",1350 bottom: 8,1351 left: (SW - 136) / 2,1352 width: 136,1353 height: 5,1354 borderRadius: 3,1355 background: c.dark ? "#fff" : "#111",1356 zIndex: 16,1357 }}1358 />1359 </Phone>1360 </div>1361 </div>1362 </ScaleLayer>1363 </AbsoluteFill>1364 );1365}









