Skip to content

Migrate demo apps to public npm SDK v3 and current prompt API - #2

Open
piavillalbam wants to merge 1 commit into
mainfrom
fix/consume-public-npm-sdk-v3
Open

Migrate demo apps to public npm SDK v3 and current prompt API#2
piavillalbam wants to merge 1 commit into
mainfrom
fix/consume-public-npm-sdk-v3

Conversation

@piavillalbam

Copy link
Copy Markdown
Collaborator

Summary

The Recurly Engage React Native SDK moved from a private, GitHub Packages-hosted @redfast scope (requiring an auth token) to the public npm registry as @recurly/engage-react-native and @recurly/engage-core at version 3.0.0. This repo's demo apps (example-mobile/, example-tv/) were frozen on the old @redfast/react-native-redfast@^1.0.16 / @redfast/redfast-core@^1.0.18 packages and the old displayPrompt(showModal, pathItem, callback) API, which no longer exists upstream.

This PR updates both demo apps to consume the new public package and the current integration pattern.

Changes

  • package.json (both apps): replaced @redfast/react-native-redfast / @redfast/redfast-core with @recurly/engage-react-native@^3.0.0 / @recurly/engage-core@^3.0.0. There was no .npmrc or registry override in this repo, and none is added — both packages resolve from plain public npm.
  • app.tsx (mobile) / App.tsx (tv): replaced manual PromptManager construction + PromptAction_Init dispatch with <PromptProvider appId="..." userId="..."> wrapping the app root, and added <PromptOverlay onEvent={...} /> at the bottom of the render tree (renders modal/banner/interstitial/video prompts automatically).
  • home.tsx / detail.tsx (both apps): replaced displayPrompt(showModal, pathItem, callback) + local showModal/pathItem state with promptMgr.screenChanged('home' | 'detail') and promptMgr.buttonClicked('clickId'). Renamed RedfastInlineRecurlyInline. Movie list, detail screen, and all other business logic are unchanged — only prompt wiring changed.
  • README.md / SKILL.md: updated remaining @redfast references and code samples to @recurly/engage-* naming and the current API.
  • tsconfig.json (both apps): set "moduleResolution": "bundler". The published package's package.json only declares types via a conditional exports map, which TypeScript's default "node" resolution (inherited from expo/tsconfig.base) cannot see — "bundler" resolves it correctly without affecting Metro's own runtime module resolution.

Impact

  • Demo apps now install from public npm with zero auth token. Verified by deleting each app's lockfile and reinstalling from a clean state with no .npmrc anywhere in the repo; @recurly/engage-react-native@3.0.0 and @recurly/engage-core@3.0.0 both resolved from https://registry.npmjs.org with no credentials.
  • Prompt display pattern changed because displayPrompt() no longer exists in the SDK. Apps now use <PromptProvider> + <PromptOverlay> (global, dispatched via context) instead of manually holding showModal/pathItem state and rendering displayPrompt(...) inline in JSX. RedfastInline is renamed to RecurlyInline.
  • What was and wasn't validated in this environment:
    • npm install / yarn install (matching each app's existing lockfile type) completed successfully for both apps, confirmed resolving @recurly/engage-*@3.0.0 from public npm with no auth.
    • npx tsc --noEmit passes cleanly for example-mobile.
    • ⚠️ npx tsc --noEmit for example-tv has one pre-existing, unrelated error (Property 'id' is missing... required in type '{ id: string; }' on Stack.Navigator) — confirmed via git stash that this error already existed in the old @redfast-based code before this migration; it's a @react-navigation v7 typing quirk unrelated to the SDK change and left as-is (not introduced or fixed by this PR).
    • No simulator/device/Metro bundle run was performed in this environment — this PR has not been visually verified to actually render prompts on iOS, Android, or TV. A human should run expo start (mobile) and expo prebuild + expo run:ios/expo run:android (tv) against a real Pulse appId/userId to confirm prompts, inline banners, and navigation still work end-to-end before treating this as fully verified.

Follow-up for reviewers

  • Run the apps on a real simulator/device with valid Pulse credentials to visually confirm modal, banner, and interstitial prompts render correctly.
  • Consider whether the example-tv pre-existing Stack.Navigator "id" TS error is worth fixing in a separate PR (unrelated to this migration).

🤖 Generated with Claude Code

The @recurly/engage-react-native and @recurly/engage-core packages
have moved from the private, GitHub Packages-hosted @redfast scope
(requiring an auth token) to the public npm registry under
@recurly/engage-* at version 3.0.0. As part of that migration the
old displayPrompt(showModal, pathItem, callback) function and the
RedfastInline component were removed upstream in favor of a
PromptProvider / PromptOverlay / usePrompt / RecurlyInline pattern.

This commit updates both demo apps (example-mobile, example-tv) to
match:

- package.json: replace @redfast/react-native-redfast and
  @redfast/redfast-core with @recurly/engage-react-native@^3.0.0 and
  @recurly/engage-core@^3.0.0. No .npmrc/registry override existed or
  is needed - both packages resolve from plain public npm.
- app.tsx / App.tsx: wrap the app root in <PromptProvider> and render
  <PromptOverlay> at the bottom of the tree instead of manually
  constructing a PromptManager and dispatching PromptAction_Init.
- home.tsx / detail.tsx: replace displayPrompt(...) + local
  showModal/pathItem state with promptMgr.screenChanged(...) and
  promptMgr.buttonClicked(...), and rename RedfastInline to
  RecurlyInline. Movie list, detail screen, and all other business
  logic are unchanged.
- Rebrand remaining @redfast references in README.md and SKILL.md to
  @recurly/engage naming and the current API.
- tsconfig.json (both apps): set moduleResolution to "bundler" so
  TypeScript can resolve the published package's conditional
  "exports" type declarations under expo/tsconfig.base's default
  "node" resolution.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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