Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .changeset/ype-5706-search-core.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@youversion/platform-react-native-expo-core': minor
---

feat: wrap platform-core SearchClient (YPE-5746). Public `useSearch` and USFM helper; verse hits use `id`.
4 changes: 4 additions & 0 deletions CONTEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,7 @@ _Avoid_: Forwarding headers from the WebView (native is authoritative); `BibleCl
**Content Read-Through**:
The interception of the Web SDK's `fetch` inside an **Expo DOM Component** that hands an eligible request's URL to the **Bible Content Client** through one **Native Action** and rebuilds a `Response` from what comes back. The WebView never performs an eligible request itself. The Web SDK and its query cache are unaware of it. Throwaway by design: it exists only while content renders in a WebView. See [ADR 0020](docs/adr/0020-bible-content-cache-below-fetch.md).
_Avoid_: Query persistence (the Web SDK's query client is private and its persister has no per-entry lifetime); a WebView-side network fallback; read/write cache actions (the bridge carries requests, not cache entries)

**Search**:
`createSearchApi` wraps `@youversion/platform-core` `SearchClient` the way highlights wraps `HighlightsClient`. Public operations: `suggestedQueries`, `trendingQueries`, `verses`, `topics`. Thrown client errors become RN `Result` (`auth` / `transient` / `invalid-parameter`). Types alias the shared Search DTOs (`id` is USFM on verse hits; query lists are `{ queries }`). The wrapper stays internal. Search is a normal JSON API, not **Bible Content Cache** / [ADR 0020](docs/adr/0020-bible-content-cache-below-fetch.md).
_Avoid_: Exporting the HTTP wrapper; treating Search as Bible Content; a parallel Search HTTP client or DTO layer
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
"jest-expo": "56.0.5"
},
"dependencies": {
"@youversion/platform-core": "2.9.0",
"@youversion/platform-core": "2.13.0",
"zod": "4.4.3"
}
}
2 changes: 1 addition & 1 deletion packages/core/src/highlights/__tests__/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ describe('createHighlightsApi', () => {
expect(header(init, 'Authorization')).toBe('Bearer tok')
expect(header(init, 'X-YVP-App-Key')).toBe('appkey')
expect(header(init, 'X-YVP-Installation-Id')).toBe('inst-1')
expect(header(init, 'x-yvp-sdk')).toBe('ReactSDK=2.9.0, ReactNativeSDK=1.0.0-dev')
expect(header(init, 'x-yvp-sdk')).toBe('ReactSDK=2.13.0, ReactNativeSDK=1.0.0-dev')
})

it('returns auth failure for 401 and 403 without throwing', async () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/hook-overrides.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { AuthContextValue } from './auth/auth-context'
import type { UseHighlightPermissionFlowResult } from './highlights/use-highlight-permission-flow'
import type { UseHighlightsOptions, UseHighlightsResult } from './highlights/use-highlights'
import type { UseSearchResult } from './search/use-search'

/**
* Test seam: skip live fetch and return stub hook results.
Expand All @@ -13,4 +14,5 @@ export type HookOverrides = {
useYVAuth?: AuthContextValue | null
useHighlights?: (options: UseHighlightsOptions) => UseHighlightsResult
useHighlightPermissionFlow?: (options: UseHighlightsOptions) => UseHighlightPermissionFlowResult
useSearch?: () => UseSearchResult
}
19 changes: 19 additions & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,22 @@ export { mmkvStorage } from './storage'

export type { BibleContentRequest, BibleContentResponse, FetchBibleContent } from './bible-content/client'

export { bibleReferenceFromUsfm, SEARCH_USER_INTENT, useSearch } from './search'
export type {
BibleReference,
SearchApiError,
SearchApiResult,
SearchTopicsParams,
SearchVersesParams,
SuggestedQueriesParams,
TrendingQueriesParams,
UseSearchResult,
YouVersionSearchQueries,
YouVersionSearchQuery,
YouVersionSearchTopic,
YouVersionSearchUserIntent,
YouVersionTopicSearchResults,
YouVersionVerseSearchResult,
YouVersionVerseSearchResults,
} from './search'

Loading