Skip to content

feat: add agent override for react and react-native SDKs#32

Merged
calthejuggler merged 3 commits intomainfrom
feature/agent-override-for-react-and-react-native
Mar 17, 2026
Merged

feat: add agent override for react and react-native SDKs#32
calthejuggler merged 3 commits intomainfrom
feature/agent-override-for-react-and-react-native

Conversation

@calthejuggler
Copy link
Contributor

@calthejuggler calthejuggler commented Mar 17, 2026

This PR overrides the agent for the react SDK in both web, and RN environments.

Before: agent: "absmartly-javascript-sdk
After:

  • React: agent: "absmartly-react-sdk"
  • React Native: agent: "absmartly-react-native-sdk"

Summary by CodeRabbit

  • New Features

    • Automatic React Native environment detection with appropriate SDK agent configuration.
    • Optional agent parameter to customise SDK agent.
  • Chores

    • Version bumped to 1.4.1.
    • Updated SDK dependency to a newer release.
    • Increased default SDK retry and timeout settings.

@coderabbitai
Copy link

coderabbitai bot commented Mar 17, 2026

Walkthrough

The PR bumps package version to 1.4.1 and updates "@absmartly/javascript-sdk" to ^1.13.4. SDKProvider now detects React Native via navigator.product and sets an agent option ("absmartly-react-native-sdk" or "absmartly-react-sdk") when initializing the SDK. SDKOptionsType gains an optional agent?: string field. Default SDK retries and timeout values are increased. Tests were added/updated to assert agent selection, agent override, and React Native behaviour.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I hopped through versions, tidy and spry,
I sniffed the product string up high,
An agent I place where the SDK may roam,
Native or React — I point it home,
Tests pat my fur and send me on my way.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarises the main change: adding agent override capability for React and React-Native SDKs, which is the primary focus across all modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/agent-override-for-react-and-react-native
📝 Coding Plan
  • Generate coding plan for human review comments

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

Comment on lines +227 to +229
const { SDKProvider: RNSDKProvider } = await import(
"../src/components/SDKProvider"
);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because isReactNative is a top-level const, we need to import this dynamically, after setting the navigator.product.value

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/SDKProvider/SDKProvider.tsx`:
- Around line 45-50: The TypeScript error comes from passing a custom SDK_AGENT
to new absmartly.SDK where the constructor's options type restricts agent to the
literal "javascript-client"; update the call in SDKProvider to satisfy types by
casting the agent to the expected type (or cast the whole options object) so the
build succeeds: locate the new absmartly.SDK instantiation in SDKProvider and
coerce SDK_AGENT (or the options spread) via a type assertion (temporary
workaround) until the upstream `@absmartly/javascript-sdk` widens its agent type.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f21500a0-58d6-43c2-8e58-8d060e130b94

📥 Commits

Reviewing files that changed from the base of the PR and between 39bcfe5 and adfb82b.

📒 Files selected for processing (4)
  • package.json
  • src/components/SDKProvider/SDKProvider.tsx
  • src/types.ts
  • tests/SDKProvider.test.tsx

@calthejuggler calthejuggler force-pushed the feature/agent-override-for-react-and-react-native branch from 312db19 to 05aa9d6 Compare March 17, 2026 12:50
@calthejuggler calthejuggler force-pushed the feature/agent-override-for-react-and-react-native branch from 05aa9d6 to 1807fc8 Compare March 17, 2026 12:54
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@package.json`:
- Line 3: Update the package.json "version" value to reflect a minor feature
release instead of a patch; change the "version" field currently set as "1.4.1"
to "1.5.0" so the SemVer bump correctly indicates new SDK behavior (edit the
"version" key in package.json).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b1adc4d8-d882-484a-a5b4-0c6652de4287

📥 Commits

Reviewing files that changed from the base of the PR and between adfb82b and 1807fc8.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (1)
  • package.json

{
"name": "@absmartly/react-sdk",
"version": "1.4.0",
"version": "1.4.1",
Copy link

@coderabbitai coderabbitai bot Mar 17, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Version bump should reflect a feature release.

This change introduces new SDK behaviour, so a minor SemVer bump is more appropriate than a patch bump.

Suggested change
-  "version": "1.4.1",
+  "version": "1.5.0",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"version": "1.4.1",
"version": "1.5.0",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` at line 3, Update the package.json "version" value to reflect a
minor feature release instead of a patch; change the "version" field currently
set as "1.4.1" to "1.5.0" so the SemVer bump correctly indicates new SDK
behavior (edit the "version" key in package.json).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Technically, this was a bug. It should have been like this already. I don't see a need to bump a minor version for this small change

Copy link

Choose a reason for hiding this comment

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

@calthejuggler, that's a fair point! If the agent identifier was simply incorrect from the start and this is correcting the expected behaviour, a patch bump is perfectly appropriate under SemVer. Happy to defer to your judgement here.

@calthejuggler calthejuggler merged commit 6ebe741 into main Mar 17, 2026
4 checks passed
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.

2 participants