You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Updates docs/puzzle-page.md to match the previous commit's replacement of
the userId-only iframe mechanism with a single, combined PuzzleContext.
- Retitled "User identity passed to the puzzle iframe" to "User/context
info passed to the puzzle iframe" and rewrote it to describe the new
PuzzleContext shape ({ userId: string | null; darkMode: boolean }), the
new guardian-puzzle-context query param (always included, JSON-encoded)
and postMessage shape, and exactly how darkMode is derived: the existing
darkModeAvailable server-side AB flag (already threaded through
PuzzlePage.tsx -> rootStyles() for the page chrome) AND the reader's
real OS/browser prefers-color-scheme preference (via DCR's existing,
generic useMatchMedia hook) - both reused, no new mechanism invented for
either half.
- Updated the "message shape needs confirming" open question to reference
PuzzleContextMessage/guardian-puzzle-context instead of the old
PuzzleUserMessage/guardian-puzzle-user, and to note the dark-mode signal
specifically also needs confirming with providers.
- Updated the dark mode open-question bullet to reflect that a dark-mode
signal is now actually sent to the iframe (previously it said no such
signal existed), while still flagging that whether AmuseLabs/Wordiply
read or honour it at all remains unconfirmed and unverified.
No functional/code changes in this commit - documentation only, following
the implementation commit.
tsc --noEmit clean, full-repo eslint clean, full test suite passing
(175 suites / 1268 tests).
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: dotcom-rendering/docs/puzzle-page.md
+78-45Lines changed: 78 additions & 45 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -149,44 +149,76 @@ iframe-based slug:
149
149
|`instance.puzzleDate`|`string?` (e.g. `"2026-09-11"`) | Which day's puzzle the reader wants to see. Accepted and validated as an optional string only — **not yet wired into any rendering or the iframe URL** (see "Open questions"). Prep work for a future V1 calendar-navigation feature; unrelated to the removed crossword-only `date` display-string field. |
150
150
|`instance.moreFromPuzzlesAndGames`|`PuzzleItem[]?` (from `src/types/puzzlesPage.ts`) | Rendered as a plain "More from Puzzles & games" list when present and non-empty. |
151
151
152
-
### User identity passed to the puzzle iframe
153
-
154
-
`src/components/PuzzleIframe.island.tsx` passes the current signed-in
155
-
reader's identity to the puzzle provider two ways:
156
-
157
-
- As a `userId` query parameter on the iframe `src` (e.g.
158
-
`?set=guardian-sudoku-easy&embed=1&idx=1&userId=<id>`), present from the
159
-
iframe's very first request.
160
-
- Via `window.postMessage({ type: 'guardian-puzzle-user', userId }, '*')`,
161
-
sent to the iframe once it has loaded.
162
-
163
-
`userId` is the reader's `idToken.claims.legacy_identity_id` (resolved via
164
-
`src/lib/identity.ts`'s `getAuthStatus()`), the same identifier already used
165
-
to build MyAccount links elsewhere in DCR (`TopBarMyAccount.tsx`) — **not**
166
-
the OIDC `sub` claim some other, newer API integrations in DCR use instead.
167
-
`userId` is omitted (both from the URL and the message) when the reader is
168
-
signed out.
169
-
170
-
The iframe reloads automatically when the reader's sign-in state changes
171
-
while already on the page (sign in, sign out, or switching accounts): the
172
-
component subscribes to auth state changes via
173
-
`src/lib/identity.ts`'s `subscribeToAuthStateChange()` (a thin wrapper
174
-
around the `@guardian/identity-auth` client's own `authStateManager.subscribe`),
175
-
and since the iframe's `src` is derived directly from the current user ID,
176
-
React gives the `<iframe>` a new `src` value whenever that changes, which
177
-
the browser treats as a fresh navigation — no manual reload call needed. The
178
-
`postMessage` above fires again after every such reload too.
152
+
### User/context info passed to the puzzle iframe
153
+
154
+
`src/components/PuzzleIframe.island.tsx` passes a combined `PuzzleContext`
155
+
about the current reader to the puzzle provider two ways:
156
+
157
+
- As a single JSON-encoded `guardian-puzzle-context` query parameter on the
0 commit comments