feat: expose BannerInitCustomization for banner styling overrides - #226
Conversation
Bridges the native BannerInitCustomization/PurposeListStyle model (already shipped in Usercentrics core SDK 2.28.0) into the RN SDK as bannerCustomization on UsercentricsOptions (init-time) and initCustomization on BannerSettings (show-time), across TypeScript, Android, and iOS.
|
CodeAnt AI is reviewing your PR. |
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
📝 WalkthroughWalkthroughChangesBanner customization
Estimated code review effort: 3 (Moderate) | ~30 minutes Sequence Diagram(s)sequenceDiagram
participant ReactNative as React Native
participant NativeBridge as Native bridge
participant BannerSettings as BannerSettings
participant UsercentricsOptions as UsercentricsOptions
ReactNative->>NativeBridge: pass initCustomization and bannerCustomization
NativeBridge->>BannerSettings: map initCustomization
NativeBridge->>UsercentricsOptions: map bannerCustomization
BannerSettings-->>ReactNative: preserve customization in showFirstLayer
UsercentricsOptions-->>ReactNative: preserve customization in configure
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for the sandbox. 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. Comment |
|
PR Summary: Add BannerInitCustomization support to native and JS layers so banner-style overrides can be passed via options or BannerSettings.
|
PR Summary by QodoExpose BannerInitCustomization for init/show-time banner styling overrides
AI Description
Diagram
High-Level Assessment
Files changed (15)
|
|
CodeAnt AI finished reviewing your PR. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/models/BannerInitCustomization.tsx (1)
12-38: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueFix formatting to comply with project guidelines.
Multiple TypeScript files in this PR use double quotes or include semicolons. As per path instructions for**/*.{ts,tsx}, Prettier formatting must be used with single quotes and no semicolons.
src/models/BannerInitCustomization.tsx#L12-L38: remove semicolons from the property declarations.src/models/BannerInitCustomization.tsx#L1-L4: replace double quotes with single quotes in the enum values.src/models/BannerSettings.tsx#L2-L2: replace double quotes with single quotes and remove the semicolon.src/models/BannerSettings.tsx#L110-L114: remove the semicolon from theinitCustomizationdeclaration.src/models/index.tsx#L1-L1: remove the trailing semicolon.src/__tests__/index.test.ts#L92-L134: remove semicolons and replace double quotes with single quotes in thetestConfigureBridgeWithBannerCustomizationtest.src/__tests__/index.test.ts#L227-L255: remove semicolons and replace double quotes with single quotes in thetestShowFirstLayerWithInitCustomizationtest.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/models/BannerInitCustomization.tsx` around lines 12 - 38, Apply the project’s Prettier style across all listed sites: remove semicolons from BannerInitCustomization property declarations, BannerSettings.initCustomization, models/index.tsx, and both specified tests; replace double-quoted enum values, imports, and test strings with single quotes. Update src/models/BannerInitCustomization.tsx ranges 1-4 and 12-38, src/models/BannerSettings.tsx ranges 2 and 110-114, src/models/index.tsx range 1, and src/__tests__/index.test.ts ranges 92-134 and 227-255.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/models/BannerInitCustomization.tsx`:
- Around line 12-38: Apply the project’s Prettier style across all listed sites:
remove semicolons from BannerInitCustomization property declarations,
BannerSettings.initCustomization, models/index.tsx, and both specified tests;
replace double-quoted enum values, imports, and test strings with single quotes.
Update src/models/BannerInitCustomization.tsx ranges 1-4 and 12-38,
src/models/BannerSettings.tsx ranges 2 and 110-114, src/models/index.tsx range
1, and src/__tests__/index.test.ts ranges 92-134 and 227-255.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b9c5d4fc-8752-4a33-95e9-17f4dcf5a3ff
⛔ Files ignored due to path filters (1)
sample/ios/Podfile.lockis excluded by!**/*.lock
📒 Files selected for processing (15)
android/src/main/java/com/usercentrics/reactnative/extensions/BannerInitCustomizationExtensions.ktandroid/src/main/java/com/usercentrics/reactnative/extensions/BannerSettingsExtensions.ktandroid/src/main/java/com/usercentrics/reactnative/extensions/ReadableMapExtensions.ktandroid/src/main/java/com/usercentrics/reactnative/extensions/UserOptionsExtensions.ktandroid/src/test/java/com/usercentrics/reactnative/extensions/BannerInitCustomizationExtensionsTest.ktios/Extensions/BannerInitCustomization+Dict.swiftios/Extensions/BannerSettings+Dict.swiftios/Extensions/UsercentricsOptions+Dict.swiftsample/ios/sampleTests/BannerInitCustomizationDictTests.swiftsample/ios/sampleTests/BannerSettingsDictTests.swiftsrc/__tests__/index.test.tssrc/models/BannerInitCustomization.tsxsrc/models/BannerSettings.tsxsrc/models/UsercentricsOptions.tsxsrc/models/index.tsx
User description
Summary
BannerInitCustomization/PurposeListStylemodel (available since Usercentrics core SDK 2.28.0, already pinned in this repo) into the React Native SDK.bannerCustomizationonUsercentricsOptions(init-time, passed toUsercentrics.initialize) and asinitCustomizationonBannerSettings(show-time, passed toshowFirstLayer/showSecondLayer) — both share the sameBannerInitCustomizationTS type, mirroring the native SDK's design.0/false/"", sincenullmeans "inherit from the layer below" in the native SDK.bannerCustomization, andinitCustomization, matching the native SDK's own@Deprecatedannotation (still fully functional, no removal date, no replacement API yet).Changes
BannerInitCustomizationclass +PurposeListStyleenum (src/models/BannerInitCustomization.tsx), wired intoUsercentricsOptionsandBannerSettings.BannerInitCustomizationExtensions.kt(ReadableMap → native object, enum parsing),getFloatOrNullhelper added, wired intoUserOptionsExtensions.ktandBannerSettingsExtensions.kt.BannerInitCustomization+Dict.swift(NSDictionary → native object, boxing raw values intoKotlinInt/KotlinFloat/KotlinBoolean), wired intoUsercentricsOptions+Dict.swiftandBannerSettings+Dict.swift.Test plan
tsc --noEmitcleannpx jest src/__tests__/index.test.ts— 34/34 passing (2 new tests added)./gradlew :react-native-usercentrics:testDebugUnitTest— full Android bridge suite passing (4 new tests added)react-native-usercentricspod target builds successfully against Usercentrics/UsercentricsUI 2.28.0xcodebuild testonsampleTests— 12/12 relevant cases passing (5 new tests added:BannerInitCustomizationDictTests+ additions toBannerSettingsDictTests)🤖 Generated with Claude Code
CodeAnt-AI Description
Expose banner styling overrides in React Native
What Changed
Impact
✅ Custom banner styling at app launch✅ Custom banner styling when showing the banner✅ Fewer missing-style regressions💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.
Summary by CodeRabbit
New Features
Bug Fixes
Tests