Skip to content

feat(rn-journey): useJourneyForm DX improvements (SDKS-5210) - #66

Open
pingidentity-gaurav wants to merge 1 commit into
mainfrom
feat/SDKS-5210-use-journey-form-dx
Open

feat(rn-journey): useJourneyForm DX improvements (SDKS-5210)#66
pingidentity-gaurav wants to merge 1 commit into
mainfrom
feat/SDKS-5210-use-journey-form-dx

Conversation

@pingidentity-gaurav

@pingidentity-gaurav pingidentity-gaurav commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Typed callback unionJourneyNormalizedField is now a discriminated union narrowed by field.type; each callback type (ChoiceCallback, TermsAndConditionsCallback, PollingWaitCallback, etc.) exposes named typed fields directly, removing the need for field.raw casts
  • form.attempted + markAttempted() — headless flag for gating validation error display on first submit attempt; resets automatically on node change
  • Node-change reset — moved from useEffect to React-idiomatic "adjust during render" pattern (matches useDavinciForm), eliminating the cascading-render lint error
  • Dev-mode warninguseJourneyForm warns when integration_required callbacks are present but not listed in handledCallbackTypes
  • Sample app updated — all Journey UI files migrated from field.ref.typefield.type shorthand and field.raw casts → typed narrowed access; resolvePromptText/resolveContentText removed and inlined
  • check-native-sdk-versions.mjs — script to verify native SDK versions stay in sync; wired to lefthook pre-commit
  • README headers removed — top-level # headings stripped from all package/app READMEs

Test plan

  • yarn test --filter=@ping-identity/rn-journey — 71 tests pass
  • yarn typecheck — clean
  • yarn lint — clean (no errors in journey package)
  • yarn prettier — clean
  • New tests: typed named fields for SuspendedTextOutputCallback, ConsentMappingCallback, FidoRegistrationCallback/FidoAuthenticationCallback
  • New tests: form.attempted starts false, markAttempted() flips to true, resets on node change, dev-warn fires/suppressed correctly

Summary by CodeRabbit

  • New Features
    • Journey forms now track whether submission has been attempted and provide clearer callback-specific field data.
    • Improved handling for device, FIDO, identity provider, polling, consent, terms, and other Journey callbacks.
  • Bug Fixes
    • Improved prompt, message, callback routing, and polling behavior across Journey screens.
  • Chores
    • Updated native Android SDK components to version 2.1.0.
    • Added validation to detect inconsistent native SDK versions before commits.
    • Simplified license headers across project documentation.

- Typed JourneyNormalizedField discriminated union with named fields per callback type
- Typed JourneyCallback union in node.types.ts
- form.attempted flag + markAttempted() with automatic reset on node change
- DeviceProfileCallback reclassified as integration_required
- Dev-mode warning when integration_required callbacks missing from handledCallbackTypes
- Node-change value reset moved from render-time setState to useEffect
- Sample app updated to use typed field API (field.type shorthand, typed casts over field.raw)
- Remove resolvePromptText / resolveContentText from valueReaders (inlined)
- check-native-sdk-versions.mjs script + lefthook pre-push hook
- Remove top-level headers from all README files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@pingidentity-gaurav
pingidentity-gaurav requested review from rodrigoareis and tsdamas and removed request for tsdamas August 24, 2026 16:25
@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

Next included review available in 51 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8757683c-8643-4ab0-a7c9-f6e7756dde71

📥 Commits

Reviewing files that changed from the base of the PR and between 903c408 and dd0d7f7.

📒 Files selected for processing (47)
  • CLAUDE.md
  • CODE_OF_CONDUCT.md
  • CONTRIBUTING.md
  • PingSampleApp/README.md
  • PingSampleApp/ui/davinci/README.md
  • PingSampleApp/ui/journey/README.md
  • PingSampleApp/ui/journey/components/molecules/renderers/JourneyBooleanField.tsx
  • PingSampleApp/ui/journey/components/molecules/renderers/JourneyChoiceField.tsx
  • PingSampleApp/ui/journey/components/molecules/renderers/JourneyFieldRenderer.tsx
  • PingSampleApp/ui/journey/components/molecules/renderers/JourneyKbaField.tsx
  • PingSampleApp/ui/journey/components/molecules/renderers/JourneyOutputField.tsx
  • PingSampleApp/ui/journey/components/molecules/renderers/JourneySelectIdpField.tsx
  • PingSampleApp/ui/journey/components/molecules/renderers/JourneyTextField.tsx
  • PingSampleApp/ui/journey/components/molecules/renderers/valueReaders.ts
  • PingSampleApp/ui/journey/components/organisms/JourneyContinuePanel.tsx
  • PingSampleApp/ui/journey/hooks/useJourneyClientPanelController.ts
  • PingSampleApp/ui/journey/hooks/useJourneyIntegrationRunner.ts
  • PingSampleApp/ui/journey/integrations/bindingIntegration.ts
  • PingSampleApp/ui/journey/integrations/fidoIntegration.ts
  • PingSampleApp/ui/journey/utils/clientPanel.ts
  • PingTestRunner/README.md
  • README.md
  • lefthook.yml
  • packages/binding/README.md
  • packages/browser/README.md
  • packages/core/README.md
  • packages/davinci/README.md
  • packages/device-client/README.md
  • packages/device-id/README.md
  • packages/device-profile/README.md
  • packages/external-idp/README.md
  • packages/fido/README.md
  • packages/journey/README.md
  • packages/journey/src/__tests__/callbackHelpers.test.ts
  • packages/journey/src/__tests__/useJourneyForm.test.tsx
  • packages/journey/src/callbackHelpers.ts
  • packages/journey/src/types/form.types.ts
  • packages/journey/src/types/node.types.ts
  • packages/journey/src/useJourneyForm.ts
  • packages/logger/README.md
  • packages/oath/README.md
  • packages/oidc/README.md
  • packages/protect/android/build.gradle
  • packages/push/README.md
  • packages/storage/README.md
  • packages/types/README.md
  • scripts/check-native-sdk-versions.mjs
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/SDKS-5210-use-journey-form-dx

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.15385% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.87%. Comparing base (903c408) to head (dd0d7f7).

Files with missing lines Patch % Lines
packages/journey/src/useJourneyForm.ts 41.93% 15 Missing and 3 partials ⚠️
packages/journey/src/callbackHelpers.ts 88.23% 0 Missing and 4 partials ⚠️

❌ Your patch check has failed because the patch coverage (66.15%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.
❌ Your project check has failed because the head coverage (71.87%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff              @@
##               main      #66      +/-   ##
============================================
- Coverage     71.96%   71.87%   -0.09%     
  Complexity      230      230              
============================================
  Files           164      203      +39     
  Lines         20856    22439    +1583     
  Branches        748     1043     +295     
============================================
+ Hits          15008    16128    +1120     
- Misses         5742     6162     +420     
- Partials        106      149      +43     
Flag Coverage Δ
android 18.21% <ø> (ø)
ios 81.45% <ø> (ø)
javascript 70.10% <66.15%> (+1.73%) ⬆️
Components Coverage Δ
Bridge glue 52.01% <ø> (+0.48%) ⬆️
Pure logic 81.50% <ø> (ø)
Files with missing lines Coverage Δ
packages/journey/src/callbackHelpers.ts 79.22% <88.23%> (+6.49%) ⬆️
packages/journey/src/useJourneyForm.ts 60.71% <41.93%> (-0.75%) ⬇️

... and 39 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 903c408...dd0d7f7. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://ForgeRock.github.io/ping-react-native-sdk/docs-preview/pr-66/

Built to branch gh-pages at 2026-08-24 16:34 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

if (prevFields !== fields) {
setPrevFields(fields);
setValuesState(hydrateValues(fields, {}));
setFormState({ values: hydrateValues(fields, {}), attempted: false });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would not be better if we move this reset into an effect keyed by fields? This seems to still update state during render.

* @remarks
* Extends shared callback shape while widening `type` so native-extension callbacks
* are represented without type assertions.
* `output` is the AM-level output array (escape hatch to raw AM data).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the native mappers do emit a top-level output? I believe the AM output is nested in the raw payload. If the mappers don't do it, since NodeCallback makes this field look available, a consumer could reasonably call callback.output.forEach(...) and hit a runtime error.

const selected = readNumber(
currentValue,
field.type === 'ChoiceCallback'
? (field as JourneyChoiceField).defaultChoice

@tsdamas tsdamas Aug 25, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the cast here? I don't think we do, because with your changes, field is already a discriminated union, so typescript should narrow it to JourneyChoiceField in this branch.

for (const file of gradleFiles) {
const versions = extractGradleVersions(file);
if (versions.length > 0) {
versionByFile.set(file, versions[0]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we validate every version found in each file instead of keeping only version[0]?

} catch {
return '';
}
}

@tsdamas tsdamas Aug 25, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a nit: should we also demonstrate gating error display until submission is attempted? :)

@tsdamas

tsdamas commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Good work! Left some minor comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants