Skip to content

Rich content links#568

Draft
ryanbas21 wants to merge 1 commit intomainfrom
rich-content-links
Draft

Rich content links#568
ryanbas21 wants to merge 1 commit intomainfrom
rich-content-links

Conversation

@ryanbas21
Copy link
Copy Markdown
Collaborator

@ryanbas21 ryanbas21 commented Apr 13, 2026

JIRA Ticket

https://pingidentity.atlassian.net/browse/SDKS-4248

Description

  • Add support for links from Translatable Rich Text in PingOne Forms (DV-19096)
  • Pass through richContent structure (template + validated replacements array) on ReadOnlyCollector
  • Validate href protocols against allowlist (OWASP A03)
  • Pure functional implementation — no throws, discriminated result types throughout

Changes

  • API Types: RichContentReplacement, RichContent (with optional replacements)
  • Collector Types: RichContentLink, ValidatedReplacement (extensible union), CollectorRichContent, ReadOnlyCollectorBase
  • Validation: validateReplacements() — validates hrefs, converts Record to array with key field
  • Collector: returnReadOnlyCollector()output.content is plain text string, output.richContent is always present with template and validated replacements array
  • Security: href validation rejects javascript:, data:, and other unsafe URI schemes (allowlist: http:, https: only)

Collector Output Shape

output: {
  key: "rich-text-0",
  label: "This is a link...",          // plain text
  type: "LABEL",
  content: "This is a link...",     
  richContent: {                        // always present
    content: "This is a {{link1}}...", // template
    replacements: [                     // validated array, [] if none/error
      { key: "link1", type: "link", value: "link", href: "https://...", target: "_blank" }
    ]
  }
}

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 13, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d2bada7f-0f0f-4b95-8046-04bf31e72a44

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rich-content-links

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 and usage tips.

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud bot commented Apr 13, 2026

View your CI Pipeline Execution ↗ for commit 24490a2

Command Status Duration Result
nx affected -t build lint test typecheck e2e-ci ⛔ Cancelled 19m 44s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-15 16:25:41 UTC

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 13, 2026

🦋 Changeset detected

Latest commit: 24490a2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
@forgerock/davinci-client Minor
@forgerock/device-client Minor
@forgerock/journey-client Minor
@forgerock/oidc-client Minor
@forgerock/protect Minor
@forgerock/sdk-types Minor
@forgerock/sdk-utilities Minor
@forgerock/iframe-manager Minor
@forgerock/sdk-logger Minor
@forgerock/sdk-oidc Minor
@forgerock/sdk-request-middleware Minor
@forgerock/storage Minor

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

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 15.07%. Comparing base (5d6747a) to head (55d0bde).
⚠️ Report is 19 commits behind head on main.

❌ Your project status has failed because the head coverage (15.07%) is below the target coverage (40.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #568       +/-   ##
===========================================
- Coverage   70.90%   15.07%   -55.83%     
===========================================
  Files          53      153      +100     
  Lines        2021    26357    +24336     
  Branches      377     1088      +711     
===========================================
+ Hits         1433     3974     +2541     
- Misses        588    22383    +21795     
Files with missing lines Coverage Δ
packages/davinci-client/src/lib/collector.types.ts 100.00% <ø> (ø)
packages/davinci-client/src/lib/collector.utils.ts 83.00% <100.00%> (ø)
packages/davinci-client/src/lib/davinci.types.ts 100.00% <ø> (ø)
packages/davinci-client/src/types.ts 50.00% <ø> (ø)

... and 97 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 13, 2026

Open in StackBlitz

@forgerock/davinci-client

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/davinci-client@568

@forgerock/device-client

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/device-client@568

@forgerock/journey-client

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/journey-client@568

@forgerock/oidc-client

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/oidc-client@568

@forgerock/protect

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/protect@568

@forgerock/sdk-types

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/sdk-types@568

@forgerock/sdk-utilities

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/sdk-utilities@568

@forgerock/iframe-manager

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/iframe-manager@568

@forgerock/sdk-logger

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/sdk-logger@568

@forgerock/sdk-oidc

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/sdk-oidc@568

@forgerock/sdk-request-middleware

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/sdk-request-middleware@568

@forgerock/storage

pnpm add https://pkg.pr.new/ForgeRock/ping-javascript-sdk/@forgerock/storage@568

commit: 55d0bde

@github-actions
Copy link
Copy Markdown
Contributor

Deployed 3d1fe8d to https://ForgeRock.github.io/ping-javascript-sdk/pr-568/3d1fe8de4e035f80612c5cb5c081f1a75d02c92c branch gh-pages in ForgeRock/ping-javascript-sdk

@github-actions
Copy link
Copy Markdown
Contributor

📦 Bundle Size Analysis

📦 Bundle Size Analysis

🚨 Significant Changes

🔻 @forgerock/device-client - 0.0 KB (-9.7 KB, -100.0%)
🔺 @forgerock/davinci-client - 43.3 KB (+2.1 KB, +5.0%)
🔻 @forgerock/journey-client - 0.0 KB (-87.8 KB, -100.0%)
🔺 @forgerock/journey-client - 89.2 KB (+1.4 KB, +1.6%)

📊 Minor Changes

📉 @forgerock/device-client - 9.7 KB (-0.0 KB)

➖ No Changes

@forgerock/oidc-client - 24.9 KB
@forgerock/sdk-utilities - 11.2 KB
@forgerock/sdk-types - 7.9 KB
@forgerock/protect - 150.1 KB
@forgerock/storage - 1.5 KB
@forgerock/sdk-oidc - 4.8 KB
@forgerock/sdk-request-middleware - 4.5 KB
@forgerock/sdk-logger - 1.6 KB
@forgerock/iframe-manager - 2.4 KB


14 packages analyzed • Baseline from latest main build

Legend

🆕 New package
🔺 Size increased
🔻 Size decreased
➖ No change

ℹ️ How bundle sizes are calculated
  • Current Size: Total gzipped size of all files in the package's dist directory
  • Baseline: Comparison against the latest build from the main branch
  • Files included: All build outputs except source maps and TypeScript build cache
  • Exclusions: .map, .tsbuildinfo, and .d.ts.map files

🔄 Updated automatically on each push to this PR

@ryanbas21 ryanbas21 force-pushed the rich-content-links branch 4 times, most recently from 3e5d66d to d6223eb Compare April 15, 2026 15:51
Copy link
Copy Markdown
Contributor

@nx-cloud nx-cloud bot left a comment

Choose a reason for hiding this comment

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

Important

At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.

Nx Cloud is proposing a fix for your failed CI:

We fix three lint errors introduced by the richContent feature: a Prettier formatting violation on long expectTypeOf chains in the type-test file, an inline object that exceeded Prettier's print width in the unit test, and an unused CollectorRichContent import in collector.utils.ts. These changes bring the code into compliance with the workspace's ESLint and Prettier rules without altering any runtime or type-level behaviour.

Tip

We verified this fix by re-running @forgerock/davinci-client:lint.

Suggested Fix changes
diff --git a/packages/davinci-client/src/lib/collector.richcontent.test-d.ts b/packages/davinci-client/src/lib/collector.richcontent.test-d.ts
index f671329c3..6142ef232 100644
--- a/packages/davinci-client/src/lib/collector.richcontent.test-d.ts
+++ b/packages/davinci-client/src/lib/collector.richcontent.test-d.ts
@@ -72,12 +72,18 @@ describe('Rich Content Types', () => {
     });
 
     it('should have required richContent with CollectorRichContent shape', () => {
-      expectTypeOf<ReadOnlyCollectorBase['output']['richContent']>().toEqualTypeOf<CollectorRichContent>();
+      expectTypeOf<
+        ReadOnlyCollectorBase['output']['richContent']
+      >().toEqualTypeOf<CollectorRichContent>();
     });
 
     it('should have standard collector fields', () => {
-      expectTypeOf<ReadOnlyCollectorBase>().toHaveProperty('category').toEqualTypeOf<'NoValueCollector'>();
-      expectTypeOf<ReadOnlyCollectorBase>().toHaveProperty('type').toEqualTypeOf<'ReadOnlyCollector'>();
+      expectTypeOf<ReadOnlyCollectorBase>()
+        .toHaveProperty('category')
+        .toEqualTypeOf<'NoValueCollector'>();
+      expectTypeOf<ReadOnlyCollectorBase>()
+        .toHaveProperty('type')
+        .toEqualTypeOf<'ReadOnlyCollector'>();
       expectTypeOf<ReadOnlyCollectorBase>().toHaveProperty('error').toEqualTypeOf<string | null>();
     });
   });
diff --git a/packages/davinci-client/src/lib/collector.utils.test.ts b/packages/davinci-client/src/lib/collector.utils.test.ts
index 67316ca25..9ff5804b6 100644
--- a/packages/davinci-client/src/lib/collector.utils.test.ts
+++ b/packages/davinci-client/src/lib/collector.utils.test.ts
@@ -1273,7 +1273,13 @@ describe('validateReplacements', () => {
     expect(result).toEqual({
       ok: true,
       replacements: [
-        { key: 'link1', type: 'link', value: 'terms', href: 'https://example.com', target: '_blank' },
+        {
+          key: 'link1',
+          type: 'link',
+          value: 'terms',
+          href: 'https://example.com',
+          target: '_blank',
+        },
         { key: 'link2', type: 'link', value: 'policy', href: 'https://xyz.com', target: '_self' },
       ],
     });
@@ -1292,9 +1298,7 @@ describe('validateReplacements', () => {
 
     expect(result).toEqual({
       ok: true,
-      replacements: [
-        { key: 'link', type: 'link', value: 'here', href: 'https://example.com' },
-      ],
+      replacements: [{ key: 'link', type: 'link', value: 'here', href: 'https://example.com' }],
     });
   });
 
diff --git a/packages/davinci-client/src/lib/collector.utils.ts b/packages/davinci-client/src/lib/collector.utils.ts
index 757f88b92..17994836e 100644
--- a/packages/davinci-client/src/lib/collector.utils.ts
+++ b/packages/davinci-client/src/lib/collector.utils.ts
@@ -32,7 +32,6 @@ import type {
   QrCodeCollectorBase,
   ValidatedReplacement,
   ValidateReplacementsResult,
-  CollectorRichContent,
   ReadOnlyCollectorBase,
 } from './collector.types.js';
 import type {

Apply fix via Nx Cloud  Reject fix via Nx Cloud


Or Apply changes locally with:

npx nx-cloud apply-locally 5kUe-VYSS

Apply fix locally with your editor ↗   View interactive diff ↗



🎓 Learn more about Self-Healing CI on nx.dev

Support RichContent link types by creating a NoValueCollector for it
@ryanbas21 ryanbas21 force-pushed the rich-content-links branch from d6223eb to 24490a2 Compare April 15, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants