Skip to content

feat(core): [NT-3533] Migrate Experience API to v3 - #487

Draft
Samuel Durkin (FailedSitcom) wants to merge 14 commits into
mainfrom
NT-3533-update-optimization-api-client-to-v-3-and-prepare-for-shared-use-with-the-experiences-sdk
Draft

Samuel Durkin (FailedSitcom) wants to merge 14 commits into
mainfrom
NT-3533-update-optimization-api-client-to-v-3-and-prepare-for-shared-use-with-the-experiences-sdk

Conversation

@FailedSitcom

Copy link
Copy Markdown

Body:

Summary

  • Migrates the Experience API to v3 (v3/spaces/{spaceId}/...) while restoring clientId as a required top-level config field, distinct from spaceId: spaceId drives the v3 Experience API path, clientId remains required by the Insights ingest API (v1/organizations/{clientId}/...).
  • Propagates clientId and contentfulEnvironment through core-sdk, the bridge, and every platform SDK (Node, React Native, Web, Android, Swift), with matching test and documentation updates.
  • Fixes two pre-existing, unrelated implementations/*/pnpm-workspace.yaml build-approval gaps (node-sdk+web-sdk, react-web-sdk, web-sdk_react) that were silently blocking core-js build scripts and breaking the pre-push hook's implementation:install step.

Test plan

  • pnpm lint / pnpm implementation:lint
  • pnpm typecheck
  • pnpm test:unit
  • Pre-push hook: full build:pkgs, implementation installs, typecheck, and unit tests across all changed workspaces and implementations
  • pnpm android:test / pnpm ios:test — confirm native config/serialization changes
  • Manual smoke test of clientId + spaceId construction against a real space/org in at least one implementation

🤖 Generated with Claude Code

…longside spaceId

Moves ExperienceApiClient from v2/organizations/:clientId/environments/:environment
paths to v3/spaces/:spaceId/environments/:contentfulEnvironment, splitting the prior
single "environment" concept into the Contentful-space contentfulEnvironment (used by
the v3 Experience API) and the Ninetailed/Optimization environment (still used only by
the v1 Insights API). Restores clientId as a required top-level config field alongside
spaceId, since both are distinct required identifiers for different APIs.

Expands the Change union beyond VariableChange to include ExperienceChange and
FragmentChange, drops the now-unused alias/group event schemas, and narrows
ResponseEnvelope's error shape accordingly. Updates the shared mock handlers and
e2e-web URL helper to the v3 route shape so downstream consumers exercise the real
contract.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…Base

CoreBase now destructures clientId and contentfulEnvironment from config and
forwards them into the ApiClientConfig it builds for ApiClient, matching the
api-client's v3 Experience API contract. ConsentPolicy's UNLOCKING_EVENT_TYPES
drops the retired group/alias event types, and FlagsResolver, applyChangeOverrides,
and CoreStatefulEventEmitter narrow their handling of the expanded Change union
(VariableChange | ExperienceChange | FragmentChange).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Updates the QuickJS bridge entry point to pass clientId and contentfulEnvironment
through to the core SDK config alongside the existing spaceId and environment
fields, so native Android/iOS hosts can supply all four values.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Updates the node-sdk's ContentfulOptimization examples, dev server, README, and
tests to include clientId and contentfulEnvironment alongside spaceId and
environment, since these flow through unchanged from CoreConfig.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…g fields

Updates the react-native-sdk's examples, dev harness env config, and tests to
include spaceId and contentfulEnvironment alongside clientId and environment,
since these flow through unchanged from CoreConfig.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…d tests

Adds spaceId to BoundNextjsOptimizationAnalyticsRootProps' Omit list alongside
clientId, since the App Router request-scoped wrapper supplies both from the
resolved server config. Updates the affected app-router, pages-router, and edge
test suites accordingly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…elds

Updates the react-web-sdk's README, dev app, error messages, and tests to include
spaceId and contentfulEnvironment alongside clientId and environment, since these
flow through unchanged from CoreConfig.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ibutes

Mirrors the existing client-id/environment attribute pattern on
ContentfulOptimizationRootElement for space-id and contentful-environment:
observed attributes, paired property accessors, and validation in createConfig
(space-id is now required alongside client-id). Updates web-sdk examples, dev
harness, and tests to match.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…onfig

Adds spaceId (required) and contentfulEnvironment (default "master") to the
Kotlin OptimizationConfig data class and its toJSON() serialization, alongside
the existing clientId and environment, matching the bridge and core SDK contract.
Updates the client init log line, README examples, and config tests.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds spaceId (required) and contentfulEnvironment (default "master") to the
Swift OptimizationConfig struct and its toJSON() serialization, alongside the
existing clientId and environment, matching the bridge and core SDK contract.
Updates the client init log line, README/CODE_MAP examples, and config tests.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ields

Updates every reference implementation that constructs an SDK config (android-sdk,
ios-sdk, all nextjs-sdk variants, node-sdk, node-sdk+web-sdk, react-native-sdk,
react-web-sdk, web-sdk, web-sdk_angular, web-sdk_react) to supply spaceId alongside
clientId, and contentfulEnvironment alongside environment, matching the v3
Experience API contract each SDK's config now requires.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…onment split

Updates authoring fragments, concept docs, integration guides, and internal
SDK-knowledge files to reflect the v3 Experience API contract: spaceId and
clientId are both required top-level config fields, and environment
(Ninetailed/Optimization, used by the Insights API) is now distinct from
contentfulEnvironment (Contentful space environment, used by the Experience API).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
allowBuilds.core-js was left as an unresolved placeholder value ("set this to
true or false") instead of true, unlike every other implementation's
pnpm-workspace.yaml. This causes pnpm install to fail with
ERR_PNPM_IGNORED_BUILDS whenever core-js is a resolved dependency, blocking the
pre-push implementation:install hook.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…-sdk_react

react-web-sdk had the same unresolved allowBuilds.core-js placeholder as
node-sdk+web-sdk, and web-sdk_react had no allowBuilds block at all. Both
resolve core-js as a dependency, so pnpm install fails with
ERR_PNPM_IGNORED_BUILDS, blocking the pre-push implementation:install hook.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@wiz-inc-38d59fb8d7

Copy link
Copy Markdown

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities -
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings 5 Low
Software Management Finding Software Management Findings -
Total 5 Low

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio.

@fmamud Felipe Mamud (fmamud) changed the title feat: [NT-3533] Migrate Experience API to v3 feat(core): [NT-3533] Migrate Experience API to v3 Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant