feat(core): add getFontStylesheetUrl helper - #391
Conversation
URL builder for the Fonts API stylesheet endpoint so core-only partners can load Untitled Serif without hand-assembling app_key query strings. Co-authored-by: Cameron Pak <cameronandrewpak@gmail.com>
🦋 Changeset detectedLatest commit: 62b82c1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
note: Cursor, an AI agent sent on behalf of Cam. This PR is the platform-core fonts helper slice of YPE-4857 only. Hub DevDocs / the vanilla recipe stay on the ticket. No |
ApiClient and YvFonts pass apiHost as a bare hostname. Prefix https:// when no scheme is present so those values do not become relative stylesheet URLs.
cameronapak
left a comment
There was a problem hiding this comment.
Review
YPE-4857 (fonts / platform-core slice)
Summary
- Standards must-fix: 0
- Spec must-fix: 0
- Worst: none (fonts slice matches locked AC; hub DevDocs is a separate PR)
For Agents
CI: pass (Lint, Type Check, Test, Build, Bundle Size, Greptile Review, changeset, i18n, locale)
Greptile: pass (prior P1 bare-host scheme resolved on f6a5949; thread resolved)
Event: COMMENT — Cam-authored (no self-APPROVE). Would approve on criteria for non-UI.
HEAD: f6a5949
Scope: helper + test + export + patch changeset only; 384/385/382 untouched
Stale Cursor note on full-origin-only apiHost is outdated vs HEAD — resolve after reply
By Code Reviewer bot, sent on behalf of Cam.
| apiHost = 'https://api.youversion.com', | ||
| }: GetFontStylesheetUrlOptions): string { | ||
| const trimmed = apiHost.replace(/\/+$/, ''); | ||
| const host = trimmed.includes('://') ? trimmed : `https://${trimmed}`; |
There was a problem hiding this comment.
praise: Bare hostname now gets an https:// prefix, with a unit test for api-staging.youversion.com. That clears the Greptile P1 without forcing partners to hand-prefix.
For Agents
Verified on f6a5949 (fix(core): accept hostname-only apiHost).
By Code Reviewer bot, sent on behalf of Cam.
Match ApiClient, YvFonts, and ADR-0004. The helper still prefixes https:// when no scheme is present, so the default stylesheet URL is unchanged.
|
Closing this in favor of |
I want to make it easier for people to be able to get the font URL and get the font properly, so this is just an easy helper to make that possible
Summary
YPE-4857 (platform-core fonts helper only). Adds a URL builder so core-only partners can load a YouVersion font stylesheet without assembling
app_keyby hand.fontIdis1(Untitled Serif)apiHostisapi.youversion.com(hostname-only, same asApiClient/YvFonts/ ADR-0004){origin}/v1/fonts/{fontId}/stylesheet?app_key={appKey}withencodeURIComponenton the app keyhttps://prefixed; full origins pass through@youversion/platform-core@youversion/platform-coreScope lock
URL builder only. This PR does not:
@font-face,FontsClient, or wireschemas/font.tsbible.css,release.yml, or UI (YvFontsstays as-is)cp/core-splitADR-0004 is unchanged: the helper encodes the same stylesheet URL the ADR already describes. No ADR edit (decision unchanged).
Test plan
fontId, originapiHost, hostname-onlyapiHost, and query encodingpnpm --filter @youversion/platform-core test— 22 files / 433 tests passed after the hostname-only defaultf6a5949was 15 green / 1 skipped;62b82c1re-runningGreptile Summary
Adds a framework-neutral helper to construct YouVersion font stylesheet URLs and exports it from the core package.
Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains; the previously reported hostname-only custom-host issue is fixed at the current head.
Important Files Changed
Reviews (3): Last reviewed commit: "fix(core): default getFontStylesheetUrl ..." | Re-trigger Greptile
Context used: