feat: add headless CDN API client and provider methods#126
Open
ethanpschoen wants to merge 8 commits into
Open
feat: add headless CDN API client and provider methods#126ethanpschoen wants to merge 8 commits into
ethanpschoen wants to merge 8 commits into
Conversation
Expose pre-WebView headless endpoints via KetchHeadless, wire them through KetchServiceProvider, and harden JSON/network error handling in the client.
8 tasks
When jurisdiction/environment aren't fully set, getFullConfiguration() falls back to the short config.json path, which previously carried no language hint. Now the short path always sends a language query param: the explicit languageCode if set, otherwise the device locale (formatted to match ketch-tag's formatLanguage convention), plus an Accept-Language header. jurisdiction/region are forwarded when explicitly set. The full static path is unchanged. Device-locale detection is extracted from KetchServiceProvider into a shared util so both the WebView and headless paths use it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of this change
Adds pre-WebView headless CDN API (
KetchHeadless,HeadlessApiClient) and wires methods throughKetchServiceProvider/useKetchService().Why is this change being made?
How was this tested? How can the reviewer verify your testing?
cd package && npm run typecheck && npm testKETCH_INTEGRATION_TESTS=1 npm run test:integrationRelated issues
KD-17456
Checklist
Note
Medium Risk
Adds server-side consent, profile, and rights APIs that send identities over the network; behavior is new but isolated behind optional context methods with documented separation from WebView consent.
Overview
Adds a pre-WebView headless stack (
KetchHeadless/HeadlessApiClient) that calls Ketch web/v3 overfetch(data-center CDN base URLs), covering geo/config, server consent get/update (with payload helpers and tolerant empty/malformed response handling), rights, profile, subscriptions, preference QR URLs, and telemetry.Those capabilities are re-exported from the package entrypoint and surfaced on
useKetchService()via a memoized headless instance inKetchServiceProvider(optional methods onKetchService; distinct from WebView-backedgetConsent).Tests: broad Jest coverage for URL building and consent behavior with injectable
fetchFn, plus opt-in live CDN integration (KETCH_INTEGRATION_TESTS=1).package.jsonaddstest/test:integrationscripts.Reviewed by Cursor Bugbot for commit fd26918. Configure here.