Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
c73934b
chore: sync react localization from platform-localization (#478)
platform-localization-pr-bot[bot] Nov 24, 2026
c913c4e
fix(core): sanitize planted footnote content in Bible HTML (#486)
cameronapak Nov 24, 2026
1326e0a
refactor(ui): organize Bible reader modules (#489)
abharms Nov 24, 2026
ab1a56a
feat(ui): re-export passage and versions hooks (#500)
cameronapak Nov 24, 2026
38b654e
fix(ui): preserve focus at high zoom (#485)
abharms Nov 24, 2026
e709a07
feat(core): add Content Library video APIs (YPE-6573) (#488)
abharms Nov 24, 2026
d582d73
feat(core): add Notes API client (#497)
cameronapak Nov 24, 2026
7ce0341
fix(ui): preserve newer selection after native Share (YPE-6812) (#494)
abharms Nov 24, 2026
f9bd014
fix(ui): label reader sign-in menu trigger (YPE-6810) (#492)
abharms Nov 24, 2026
6994c73
fix(ui): handle reader clipboard failures (#490)
abharms Nov 24, 2026
51024a3
fix(ui): support Bible reader interactions in iframes (YPE-6410) (#491)
abharms Nov 24, 2026
7398f57
fix(ui): handle reader host callback exceptions (YPE-6811) (#493)
abharms Nov 24, 2026
1ddd22d
chore(ui): align declaration build with strict checks (YPE-6464) (#503)
abharms Nov 25, 2026
d5f5279
chore: enable additional TypeScript safety checks (#505)
abharms Nov 25, 2026
594e005
feat(ui): customize verse actions and indicators (#506)
abharms Nov 27, 2026
6c375cb
feat(ui): add Reader note saving
abharms Nov 27, 2026
48fc3ff
fix: recover Reader Notes after interrupted authorization
abharms Nov 27, 2026
2e454f1
fix: preserve Reader Notes through authorization
abharms Nov 27, 2026
24e6dd4
fix: preserve Reader sessions and highlight refresh
abharms Nov 27, 2026
20fe224
fix: preserve Reader draft recovery and auth compatibility
abharms Nov 27, 2026
28e5d2a
fix: preserve Reader auth and passage ownership
abharms Nov 27, 2026
1f0a017
fix: preserve Reader drafts and OAuth attempt ownership
abharms Nov 27, 2026
db5916d
fix: isolate Reader authorization handoffs
abharms Nov 27, 2026
b3d6035
fix: recover Reader note edits after a lost response
abharms Nov 27, 2026
5f51dcb
fix: retry Notes writes after definite rejections
abharms Nov 27, 2026
7d6cfbd
fix: retry corrected Notes payloads after a 413
abharms Nov 27, 2026
bf833d6
fix(ui): preload destination highlights (YPE-6783)
abharms Nov 27, 2026
a4a7063
docs: clarify legacy auth recovery (YPE-6783)
abharms Nov 27, 2026
cc1c061
test(ui): await destination passage before save refresh (YPE-6783)
abharms Nov 27, 2026
3bc1d44
test(ui): await settled highlight colors (YPE-6783)
abharms Nov 27, 2026
0b93362
chore: sync react localization
camrun91 Nov 25, 2026
49bb3d9
fix(ui): announce note highlight color names
abharms Nov 28, 2026
c479eed
fix(ci): verify imported localization provenance
abharms Nov 28, 2026
9ce6165
fix(ui): expose action labels and record Notes QA evidence
abharms Nov 30, 2026
6ae9bff
chore: merge main and retire merged localization import
abharms Nov 30, 2026
928e1eb
chore: remove pilot reports and obsolete localization support
abharms Nov 30, 2026
6625bab
chore: merge latest package release from main
abharms Nov 30, 2026
6c15f86
fix: harden Reader Notes authorization and integration
abharms Nov 30, 2026
f80f2ab
fix: refresh OAuth tree-shaking sentinel
abharms Nov 30, 2026
2963e39
refactor: narrow reader notes auth and test scope
abharms Nov 30, 2026
eb2d942
test: remove redundant notes browser scenarios
abharms Nov 30, 2026
047ece5
refactor: reuse oauth cleanup and reader scope checks
abharms Nov 30, 2026
fafcba3
feat: add reader note indicators and saved notes
abharms Nov 29, 2026
fcff908
test: align saved notes checks with current reader
abharms Dec 1, 2026
cf14e39
fix: isolate notes denial from version policy failures
abharms Dec 1, 2026
6e43351
fix: fence notes reads across access changes
abharms Dec 1, 2026
ef9a4e4
fix: retain notes privacy across provider lifetimes
abharms Dec 1, 2026
a96e36b
fix(ui): align notes composer with save design
abharms Dec 1, 2026
998cbdd
test(ui): wait for clipboard retry action visibility
abharms Dec 1, 2026
dc45c06
fix(ui): accept normalized note save responses
abharms Dec 1, 2026
ee14e6b
fix(ui): preserve verse action compatibility for notes
abharms Dec 1, 2026
74e1008
chore: sync main into reader notes branch
abharms Dec 1, 2026
ed3a116
chore: merge reader notes parent into saved notes
abharms Dec 1, 2026
4e6009d
fix(ui): align saved note visibility badges with design
abharms Dec 1, 2026
2aa0b9e
fix(ui): match saved note cards to reader design
abharms Dec 1, 2026
703bb49
test: distinguish note reads and stabilize browser journeys
abharms Dec 1, 2026
0b6a237
fix(ui): recover note drafts after validation rejections
abharms Dec 1, 2026
4e8f448
chore: sync react localization
abharms Dec 1, 2026
15c50dd
chore: consume notes visibility localization
abharms Dec 1, 2026
ee02523
fix(ui): name the note visibility selector accessibly
abharms Dec 1, 2026
96c9779
chore: sync localization delivery from main
abharms Dec 1, 2026
8d15f68
refactor: simplify notes indicator ownership and refresh
abharms Dec 1, 2026
0e576f4
chore: sync reader notes parent and localization
abharms Dec 1, 2026
44c1216
fix(ui): use passage-specific saved note wording
abharms Dec 1, 2026
fd7594f
chore: merge main after reader notes parent merge
abharms Dec 2, 2026
c38f30c
fix(hooks): clear denied Notes across cache partitions
abharms Dec 2, 2026
adae10d
fix(hooks): honor Notes denials after query cancellation
abharms Dec 2, 2026
8c8ee18
refactor(hooks): encapsulate chapter Notes cache policy
abharms Dec 2, 2026
8448259
fix(hooks): isolate chapter Notes denial cleanup
abharms Dec 2, 2026
67a592e
fix(hooks): refresh Notes across locale and filter changes
abharms Dec 2, 2026
8d57c22
chore: clean up Notes styles, docs, and browser checks
abharms Dec 2, 2026
b2efca8
Merge remote-tracking branch 'origin/main' into codex/YPE-6784-reader…
abharms Dec 2, 2026
f46490b
fix(ui): preserve reader highlight selection and modal scrolling
abharms Dec 2, 2026
d60f2ed
fix(ui): cap note editor height at three lines
abharms Dec 3, 2026
7515b80
fix(ui): align note composer actions and show saved counts
abharms Dec 3, 2026
9abdabc
chore: merge main into reader note indicators
abharms Dec 3, 2026
43bfc69
fix(ui): reveal truncated saved notes with shared More label
abharms Dec 3, 2026
c9ca36f
fix(hooks): retain confirmed notes until chapter lists catch up
abharms Dec 3, 2026
9ff2ecb
fix(reader): simplify saved-note refresh and preserve color clears
abharms Dec 4, 2026
38caa65
Merge remote-tracking branch 'origin/main' into codex/YPE-6784-reader…
abharms Dec 4, 2026
0d782ca
fix(hooks): finish initial Notes reads across successive saves
abharms Dec 4, 2026
ca86fec
fix(ui): center verse indicators beneath the number glyphs
abharms Dec 4, 2026
58789b8
refactor: simplify notes cache and reader components
abharms Dec 4, 2026
96c02a2
chore: merge main into reader notes branch
abharms Dec 4, 2026
28efa7f
fix(ui): add note context to More buttons
abharms Dec 4, 2026
85494d4
fix(ui): match native verse note indicators
abharms Dec 4, 2026
dd8e802
fix(ui): preserve note number contrast on dark highlights
abharms Dec 4, 2026
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
25 changes: 25 additions & 0 deletions .changeset/reader-saved-note-indicators.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
'@youversion/platform-core': patch
'@youversion/platform-react-hooks': minor
'@youversion/platform-react-ui': minor
---

Show saved notes with rounded indicator backgrounds behind verse numbers, using
25% gray over highlights and 55% blue otherwise to match the native SDKs, and in a drawer
with passage, visibility, localized age, color, and expandable six-line previews. Standalone BibleTextView
callers can handle note indicators with `onNoteIndicatorPress`.
Preserve contrasting verse-number text over dark highlights.

Add `useChapterNotes` and `useDeleteNote`. Successful note writes refresh
highlights while preserving settled data. Creates update matching chapter Notes
directly; later complete reads replace that snapshot. Updates and deletes re-read Notes. Clear private notes when read access is lost.

Keep one swatch per color and check existing selection colors in place. Make the
unused `VerseActionPopover` props `selectedVerses` and `highlightedVerses` optional
and deprecated; use `activeHighlights` for checked colors. The Save
composer retains history while editing, caps the editor at three lines, supports
modal scrolling, and disables Save until a draft changes. Keep shared dialogs within
narrow viewports by including padding in their declared width.

Expose auth-session change subscriptions and identify Notes collection access
denials separately from Bible preflight failures.
14 changes: 10 additions & 4 deletions docs/adr/0006-tanstack-query-read-layer.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,20 @@ No TanStack Query type reaches the public surface.

The cache is memory-only. `refetch` performs exact query invalidation. Highlight
writes stay outside this read layer, owned by the highlights machine, and refresh
via `refetch` after the write. Reader Notes saves also use `refetch` to refresh the
displayed chapter's highlights.
via `refetch` after the write. Successful Notes mutations for the signed-in account
refresh its active highlights in the provider's cache for the displayed chapter
and Bible version. A successful create updates matching chapter Notes directly
and marks them stale for the next read. Updates and deletes refresh Notes too.
Complete chapter reads remain authoritative; no separate retained-create list
overrides later successful snapshots.

Highlight refetch also restarts an active initial read when it has no cached
result. That read may have started before the write and could return outdated
data; the restart fetches the post-write state. Settled cached data stays visible
during revalidation. Other read hooks retain exact invalidation without this
initial-read restart.
during revalidation. Chapter Notes use the same restart after an update, delete, or
explicit refetch. An initial paged read can finish alongside a create and merges
that confirmed Note once, so earlier saved Notes are still collected. The chapter Notes query publishes the complete paginated snapshot and
clears it on loss of Notes read access.

## Why

Expand Down
12 changes: 10 additions & 2 deletions examples/vite-react/scripts/smoke-reader-notes.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ await context.route(`${api}/**`, async (route) => {
}
return json({ data: [] });
case '/v1/notes': {
if (request.method() === 'GET') return json({ data: [] });
assert.equal(request.method(), 'POST', 'Expected a supported Notes operation');
const body = request.postDataJSON();
notes.push({ body, authorization: request.headers()['authorization'] });
return json({ ...body, id: 'smoke-note' }, 201);
Expand Down Expand Up @@ -413,9 +415,15 @@ try {
passage: { bible_id: 3034, passage_id: 'JHN.1.2+JHN.1.4' },
});

// A confirmed save is immediately available even while the list endpoint is stale.
await page.getByRole('button', { name: 'Notes 2', exact: true }).click();
await composer(page, 'John 1:2').waitFor();
assert.equal(
await composer(page, 'John 1:2').getByText('Notes smoke', { exact: true }).count(),
1,
);

// A background tab can process Bob's sign-out only after Bob has signed in again.
await selectVerses(page, [2]);
await beginNote(page);
await editor(page).fill('Draft from the ended Bob session');
await page.evaluate(() => window.delayStorageEvents());
await signOut(other);
Expand Down
31 changes: 31 additions & 0 deletions packages/core/src/YouVersionPlatformConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ import {
AUTH_SCOPE_KEY,
} from './auth-storage-keys';

const AUTH_SESSION_CHANGED_EVENT = 'youversion:auth-session-changed';

function notifyAuthSessionChanged(): void {
const browser = globalThis.window;
if (browser?.Event) {
browser.dispatchEvent?.(new browser.Event(AUTH_SESSION_CHANGED_EVENT));
}
}

function parseStoredUserInfo(raw: string | null | undefined): YouVersionUserInfoJSON | null {
if (!raw) return null;
try {
Expand Down Expand Up @@ -107,6 +116,7 @@ export class YouVersionPlatformConfiguration {
}

if (persisted) invalidateAuthorization(storage, previousState);
notifyAuthSessionChanged();
return persisted;
}

Expand All @@ -126,11 +136,13 @@ export class YouVersionPlatformConfiguration {
if (userInfo === null) {
removeStorageItem(storage, AUTH_USER_INFO_KEY);
if (!storage?.getItem(AUTH_USER_INFO_KEY)) invalidateAuthorization(storage, previousState);
notifyAuthSessionChanged();
return true;
}

const persisted = setStorageItem(storage, AUTH_USER_INFO_KEY, JSON.stringify(userInfo));
if (persisted) invalidateAuthorization(storage, previousState);
notifyAuthSessionChanged();
return persisted;
}

Expand Down Expand Up @@ -185,6 +197,25 @@ export class YouVersionPlatformConfiguration {
);
}

/**
* Subscribes to SDK credential or profile writes in this document and auth
* storage changes from other documents. Re-read the current session in the
* callback, which receives no credentials.
* Returns an unsubscribe function.
*/
public static subscribeToAuthSessionChanges(this: void, listener: () => void): () => void {
const browser = globalThis.window;
const onStorage = (event: StorageEvent) => {
if (YouVersionPlatformConfiguration.isAuthSessionEvent(event)) listener();
};
browser?.addEventListener?.(AUTH_SESSION_CHANGED_EVENT, listener);
browser?.addEventListener?.('storage', onStorage);
return () => {
browser?.removeEventListener?.(AUTH_SESSION_CHANGED_EVENT, listener);
browser?.removeEventListener?.('storage', onStorage);
};
}

/** @internal A legacy rotation completed after this account's scoped binding was written. */
public static get hasExpiredLegacyRotation(): boolean {
const storage = getLocalStorage();
Expand Down
38 changes: 38 additions & 0 deletions packages/core/src/__tests__/auth-session-events.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { expect, it, vi } from 'vitest';
import { JSDOM } from 'jsdom';
import { YouVersionPlatformConfiguration } from '../YouVersionPlatformConfiguration';

it('keeps auth writes and notifications working in a grafted DOM window', () => {
const embedded = new JSDOM('', { url: 'https://sdk.example' });
expect(embedded.window.Event).not.toBe(Event);
vi.stubGlobal('window', embedded.window);
const observed: (string | null)[] = [];
const unsubscribe = YouVersionPlatformConfiguration.subscribeToAuthSessionChanges(() => {
observed.push(YouVersionPlatformConfiguration.getOAuthAccessToken('realm-user', 'read_notes'));
});

try {
expect(
YouVersionPlatformConfiguration.saveAuthData('realm-access', 'realm-refresh', null, {
scope: 'read_notes',
userId: 'realm-user',
}),
).toBe(true);
expect(YouVersionPlatformConfiguration.saveUserInfo({ id: 'realm-user' })).toBe(true);
expect(observed).toEqual([null, 'realm-access']);
expect(YouVersionPlatformConfiguration.getOAuthAccessToken('realm-user', 'read_notes')).toBe(
'realm-access',
);

unsubscribe();
YouVersionPlatformConfiguration.clearAuthTokens();
expect(observed).toEqual([null, 'realm-access']);
expect(
YouVersionPlatformConfiguration.getOAuthAccessToken('realm-user', 'read_notes'),
).toBeNull();
} finally {
unsubscribe();
vi.unstubAllGlobals();
embedded.window.close();
}
});
1 change: 1 addition & 0 deletions packages/core/src/__tests__/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ describe('ApiClient contracts', () => {
});
YouVersionPlatformConfiguration.installationId = null;
expect(await installId()).toBe('persisted-id');
expect(new ApiClient({ appKey: 'k' }).config.installationId).toBe('persisted-id');
} finally {
vi.unstubAllGlobals();
YouVersionPlatformConfiguration.installationId = null;
Expand Down
24 changes: 18 additions & 6 deletions packages/core/src/__tests__/notes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,17 +225,27 @@ describe.skipIf(Boolean(process.env.INTEGRATION_TESTS))('NotesClient', () => {
const client = createClient();
const create = { request_id: requestId, content: note.content, status: note.status };
for (const status of [401, 403]) {
const statusText = status === 401 ? 'Unauthorized' : 'Forbidden';
server.use(
http.all(`${collectionUrl}*`, () => HttpResponse.json({ message: 'Denied' }, { status })),
http.all(`${collectionUrl}*`, () =>
HttpResponse.json({ message: 'Denied' }, { status, statusText }),
),
);
const list = client.getNotes({}, 'token');
await expect(list.catch(getHttpStatus)).resolves.toBe(status);
await expect(list).rejects.toMatchObject({ statusText });
await expect(list).rejects.toSatisfy((error: Error) => NotesClient.isListAccessDenied(error));
for (const operation of [
() => client.getNotes({}, 'token'),
() => client.getNote(noteId, 'token'),
() => client.createNote(create, 'token'),
() => client.updateNote(noteId, { title: null }, 'token'),
() => client.deleteNote(noteId, 'token'),
]) {
await expect(operation().catch(getHttpStatus)).resolves.toBe(status);
const denied = operation();
await expect(denied.catch(getHttpStatus)).resolves.toBe(status);
await expect(denied).rejects.not.toSatisfy((error: Error) =>
NotesClient.isListAccessDenied(error),
);
}
}
});
Expand Down Expand Up @@ -388,9 +398,11 @@ describe.skipIf(Boolean(process.env.INTEGRATION_TESTS))('NotesClient', () => {
},
]) {
Object.assign(config, filters);
await expect(
client.getNotes({ version_id: 3034 }, 'reader').catch(getHttpStatus),
).resolves.toBe(403);
const refused = client.getNotes({ version_id: 3034 }, 'reader');
await expect(refused.catch(getHttpStatus)).resolves.toBe(403);
await expect(refused).rejects.not.toSatisfy((error: Error) =>
NotesClient.isListAccessDenied(error),
);
await expect(client.createNote(create, 'writer').catch(getHttpStatus)).resolves.toBe(403);
await expect(
client.updateNote(noteId, { passage: note.passage }, 'writer').catch(getHttpStatus),
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export class ApiClient {
this.baseURL = 'https://' + apiHost;
this.timeout = config.timeout || 10000;
const installationId = config.installationId || getInstallationId();
this.config.installationId = installationId ?? undefined;
this.defaultHeaders = {
'Content-Type': 'application/json',
'X-YVP-App-Key': this.config.appKey,
Expand Down
20 changes: 18 additions & 2 deletions packages/core/src/notes.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as z from 'zod/mini';
import { resolveAuthToken } from './auth-token';
import { assertUsableVersion } from './bible-chapter';
import type { ApiClient } from './client';
import { getHttpStatus, type ApiClient, type ApiResponse } from './client';
import {
CreateNoteSchema,
NoteIdSchema,
Expand All @@ -15,6 +15,7 @@ import { object } from './schemas/object';
import type { Collection, CreateNote, Note, NotePassage, UpdateNote } from './types';

const NOTES_PATH = '/v1/notes';
const listAccessDenials = new WeakSet<Error>();

const GetNotesOptionsSchema = object({
/** Filter by Bible version. Sent on the wire as `bible_id`. */
Expand Down Expand Up @@ -71,6 +72,11 @@ export class NotesClient {
this.client = client;
}

/** True for an HTTP 401 or 403 received from the Notes collection by `getNotes`. */
static isListAccessDenied(error: Error): boolean {
return listAccessDenials.has(error);
}

/**
* Lists one page of notes with `read_notes` access. An empty page can still have a continuation token.
* Malformed notes are skipped without discarding the page's continuation token.
Expand All @@ -88,7 +94,17 @@ export class NotesClient {
if (passage_id !== undefined) query.passage_id = passage_id;
if (page_size !== undefined) query.page_size = page_size;
if (page_token != null) query.page_token = page_token;
const { status, data } = await this.client.getWithStatus<unknown>(NOTES_PATH, query, headers);
let response: ApiResponse<unknown>;
try {
response = await this.client.getWithStatus<unknown>(NOTES_PATH, query, headers);
} catch (error) {
const status = getHttpStatus(error);
if (error instanceof Error && (status === 401 || status === 403)) {
listAccessDenials.add(error);
}
throw error;
}
const { status, data } = response;
if (status === 204) {
return { data: [], next_page_token: null };
}
Expand Down
5 changes: 5 additions & 0 deletions packages/hooks/src/hook-overrides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type {
} from '@youversion/platform-core';
import type { UseApiDataOptions } from './useApiData';
import type { UseBooksResult } from './useBooks';
import type { ChapterNotesOptions, UseChapterNotesResult } from './useChapterNotes';
import type { UseHighlightsResult } from './useHighlights';
import type { UseLanguageResult } from './useLanguage';
import type { UseLanguagesResult } from './useLanguages';
Expand All @@ -24,6 +25,10 @@ import type { UseVerseOfTheDayResult } from './useVOTD';
*/
export type HookOverrides = {
useBooks?: (versionId: number, options?: UseApiDataOptions) => UseBooksResult;
useChapterNotes?: (
options: ChapterNotesOptions,
apiOptions?: UseApiDataOptions,
) => UseChapterNotesResult;
useFilteredVersions?: (
versions: BibleVersion[],
searchTerm: string,
Expand Down
2 changes: 2 additions & 0 deletions packages/hooks/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export * from './useUnifiedSearch';
export * from './usePassage';
export * from './useVOTD';
export * from './useHighlights';
export * from './useChapterNotes';
export * from './useCreateNote';
export * from './useDeleteNote';
export * from './useUpdateNote';
export * from './useHighlightAuthActions';
export * from './useLanguages';
Expand Down
7 changes: 6 additions & 1 deletion packages/hooks/src/internal/QueryClientContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
type ReactNode,
} from 'react';
import type { QueryClient } from '@tanstack/react-query';
import { subscribeToChapterNotesRevocation } from './chapterNotesCache';

/**
* @internal
Expand Down Expand Up @@ -62,7 +63,11 @@ export function InternalQueryClientProvider({
}): ReactElement {
useEffect(() => {
client.mount();
return () => client.unmount();
const unsubscribe = subscribeToChapterNotesRevocation(client);
return () => {
unsubscribe();
client.unmount();
};
}, [client]);
return <QueryClientContext.Provider value={client}>{children}</QueryClientContext.Provider>;
}
Expand Down
Loading
Loading