feat: add agent override for react and react-native SDKs#32
Conversation
WalkthroughThe PR bumps package version to 1.4.1 and updates "@absmartly/javascript-sdk" to ^1.13.4. SDKProvider now detects React Native via Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
| const { SDKProvider: RNSDKProvider } = await import( | ||
| "../src/components/SDKProvider" | ||
| ); |
There was a problem hiding this comment.
Because isReactNative is a top-level const, we need to import this dynamically, after setting the navigator.product.value
There was a problem hiding this comment.
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
📒 Files selected for processing (4)
package.jsonsrc/components/SDKProvider/SDKProvider.tsxsrc/types.tstests/SDKProvider.test.tsx
312db19 to
05aa9d6
Compare
05aa9d6 to
1807fc8
Compare
There was a problem hiding this comment.
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
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (1)
package.json
| { | ||
| "name": "@absmartly/react-sdk", | ||
| "version": "1.4.0", | ||
| "version": "1.4.1", |
There was a problem hiding this comment.
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.
| "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).
There was a problem hiding this comment.
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
There was a problem hiding this comment.
@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.
This PR overrides the agent for the react SDK in both web, and RN environments.
Before:
agent: "absmartly-javascript-sdkAfter:
agent: "absmartly-react-sdk"agent: "absmartly-react-native-sdk"Summary by CodeRabbit
New Features
Chores