# @simon-says-build/demo-player

The mobile half of SimonSays demos (docs/MOBILE-DEMO.md): a job's preview, opened in the app's dev client, walks the viewer through the change.

```tsx
import { router } from "expo-router";
import { DemoHost } from "@simon-says-build/demo-player";

<DemoHost
  router={router}
  demo={{
    id: process.env.EXPO_PUBLIC_SSB_DEMO_ID,
    token: process.env.EXPO_PUBLIC_SSB_DEMO_TOKEN,
    api: process.env.EXPO_PUBLIC_SSB_API,
  }}
>
  {/* the app */}
</DemoHost>
```

Pass the `process.env.EXPO_PUBLIC_*` reads in the app's own code. Expo inlines them where the app references them, so the values only exist in a bundle a demo preview served.

Without all three it renders its children and nothing else. Elements are found by `testID`, then `accessibilityLabel`, then visible text, by walking React's tree. No component needs wrapping.

**0.7.0: the sign-in link opens through the app's router** (`openInApp`), not `Linking.openURL`. The link names app.json's scheme, and a review plays in the dev build, whose scheme can differ (Walk2Gether's is `walk2gether-dev`), so the OS opened the production app or nothing. Without a `router`, the OS opens it as before.

**0.6.0: SSB signs the viewer in** on a phone's private, seeded copy (docs/MOBILE-DEMO.md "Sign-in (stage 2: SSB signs in)"). Before each person's part the player asks the demo API for their sign-in link (`POST /api/demo/:id/signin`), opens it with `Linking.openURL`, waits for the app to settle, and starts on the screen the link opened. The walk's own sign-in steps are skipped. The app must handle `<scheme>://auth?token=<custom token>&next=<path>`: sign in with the custom token, then route to `next`. Where there is no link (the app's real backend, no URL scheme, the copy not up), the card says who to sign in as, as before.

`npm test` runs the pure half.
