MOB-2372: Upgrading SDK and refactor exports - #9
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request modernizes the module's API by transitioning from a mixed default/namespace export pattern to clean named exports, following React Native best practices. The changes also include native SDK version upgrades for both iOS and Android platforms, along with a redesigned demo application UI.
Changes:
- Refactored module API from namespace exports (
TSAccountProtectionSDK.TSAction) to direct named exports (TSAction) - Upgraded iOS AccountProtection SDK from 0.0.8006 to 2.2.0 and Android from 2.2.4 to 2.2.5
- Redesigned demo app UI with modern banking interface aesthetics
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/index.tsx | Removed namespace wrapper and class instance, converted to direct named exports of types and functions |
| react-native-ts-accountprotection.podspec | Updated iOS AccountProtection dependency from 0.0.8006 to 2.2.0 |
| android/build.gradle | Updated Android AccountProtection dependency from 2.2.4 to 2.2.5 |
| example/ios/Podfile.lock | Lock file reflecting iOS dependency updates including TSCoreSDK upgrade to 1.1.2 |
| example/src/App.tsx | Updated imports to use new named export pattern |
| example/src/screens/login.tsx | Redesigned login UI with modern banking theme and improved styling |
| example/src/screens/authenticated-user.tsx | Redesigned authenticated user UI with account overview and improved transfer form |
| RELEASE_NOTES.md | Added comprehensive release notes for version 0.2.0 documenting breaking changes |
| README.md | Updated code examples to demonstrate new named export usage |
| MIGRATION_0.1.9-0.2.0.md | Created migration guide with step-by-step instructions for updating to new API |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export const enum TSAction { | ||
| login = 'login', | ||
| register = 'register', | ||
| transaction = 'transaction', | ||
| checkout = 'checkout', | ||
| password_reset = 'password_reset', | ||
| logout = 'logout', | ||
| account_details_change = 'account_details_change', | ||
| account_auth_change = 'account_auth_change', | ||
| withdraw = 'withdraw', | ||
| credits_change = 'credits_change', | ||
| } |
There was a problem hiding this comment.
Using const enum for TSAction can cause issues with tree-shaking and module boundaries in some bundlers. Since this is a public API that will be consumed by external applications, consider changing export const enum TSAction to export enum TSAction to ensure better compatibility. Const enums are inlined at compile time, which can lead to TypeScript transpilation issues when used across module boundaries, especially with isolatedModules flag enabled.
| @@ -14,7 +14,7 @@ Pod::Spec.new do |s| | |||
| s.platforms = { :ios => min_ios_version_supported } | |||
| s.source = { :git => "https://github.com/TransmitSecurity/react-native-ts-accountprotection.git", :tag => "#{s.version}" } | |||
|
|
|||
There was a problem hiding this comment.
The iOS SDK is being upgraded from version 0.0.8006 to 2.2.0, which represents a major version jump (from pre-1.0 to 2.x). This significant version change should be documented in the release notes, especially if there are any breaking changes or important migration steps required at the native SDK level. Consider adding a note about the native SDK upgrade in the release notes to inform users of potential native-level changes.
| # NOTE: The native iOS SDK dependency 'AccountProtection' has been upgraded to 2.2.0 | |
| # from a pre-1.0 version (e.g. 0.0.8006). Ensure this major native SDK change, and any | |
| # breaking changes or migration steps, are clearly documented in the project release notes. |
🚀 Refactor to Named Exports - Breaking Changes
Modernizes module API by switching from mixed default/namespace exports to clean named exports following React Native best practices.
Changes:
✅ Named imports: import { initializeIOS, TSAction } from '...'
✅ Tree-shaking support
✅ Better TypeScript IntelliSense
✅ Redesigned demo app
📋 Migration guide included
Breaking: Update imports & remove module prefixes