@circle-fin/w3s-pw-react-native-sdk 2.0.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,6 +10,12 @@
10
10
 
11
11
  ---
12
12
 
13
+ ## Migrating from SDK v1 (Bare React Native)
14
+
15
+ If you have an existing bare React Native project using SDK v1 and want to upgrade to SDK v2, see the [SDK v1 Migration Guide](https://github.com/circlefin/w3s-react-native-sample-app-wallets/blob/master/MIGRATION_GUIDE.md).
16
+
17
+ You can also find the SDK v1 sample app in the sample app repository's [sdk-v1 branch](https://github.com/circlefin/w3s-react-native-sample-app-wallets/tree/sdk-v1).
18
+
13
19
  ## System Requirements
14
20
 
15
21
  | Platform | Minimum Version | Recommended Version |
@@ -96,8 +102,7 @@ During `expo prebuild`, files from `prebuild-sync-src/android` → `android/` an
96
102
  | `sourceDir` | `prebuild-sync-src` | Root directory with android/ and ios/ folders |
97
103
  | `overwrite` | `true` | Whether to overwrite existing files |
98
104
 
99
- > [!NOTE]
100
- > This solves the problem of `expo prebuild --clean` erasing manual changes.
105
+ **Note:** This solves the problem of `expo prebuild --clean` erasing manual changes.
101
106
 
102
107
  </details>
103
108
 
@@ -211,6 +216,8 @@ eas build --profile development --platform all
211
216
  - [User-Controlled Wallets Documentation](https://developers.circle.com/wallets/user-controlled) - Product overview and architecture
212
217
  - [React Native SDK Documentation](https://developers.circle.com/wallets/user-controlled/react-native-sdk) - Complete API reference
213
218
  - [UI Customization API](https://developers.circle.com/wallets/user-controlled/react-native-sdk-ui-customization-api) - Theming and localization options
219
+ - [React Native Sample App](https://github.com/circlefin/w3s-react-native-sample-app-wallets) - Working Expo sample app with integration guide
220
+ - [SDK v1 Migration Guide](https://github.com/circlefin/w3s-react-native-sample-app-wallets/blob/master/MIGRATION_GUIDE.md) - Complete guide for upgrading from bare React Native + SDK v1 to Expo Modules + SDK v2
214
221
 
215
222
  **Expo Resources:**
216
223
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@circle-fin/w3s-pw-react-native-sdk",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "packageManager": "yarn@1.22.22",
5
5
  "description": "React Native SDK for Circle Programmable Wallet",
6
6
  "main": "build/index.js",
@@ -44,7 +44,8 @@
44
44
  "format": "prettier --write .",
45
45
  "format:check": "prettier --check .",
46
46
  "check:type": "tsc --noEmit",
47
- "publish:sdk": "npm publish --registry https://npm.pkg.github.com/"
47
+ "publish:sdk": "npm publish --registry https://npm.pkg.github.com/",
48
+ "test:with-copy-files": "npm --prefix ./example run verify:with-copy-files"
48
49
  },
49
50
  "keywords": [
50
51
  "react-native",
@@ -37,21 +37,32 @@ function copyFile(srcPath, dstPath, overwrite = true) {
37
37
  console.log(`[withCopyFiles] Copied: ${srcPath} -> ${dstPath}`)
38
38
  }
39
39
 
40
- function copyDirRecursive(srcDir, dstDir, overwrite = true, excludeFiles = []) {
40
+ function normalizeRelativePath(relativePath) {
41
+ return relativePath.split(path.sep).join('/')
42
+ }
43
+
44
+ function copyDirRecursive(
45
+ srcDir,
46
+ dstDir,
47
+ overwrite = true,
48
+ excludeFiles = [],
49
+ relativeDir = '',
50
+ ) {
41
51
  if (!fs.existsSync(srcDir)) return
42
52
  const entries = fs.readdirSync(srcDir, { withFileTypes: true })
43
53
  for (const entry of entries) {
44
54
  const s = path.join(srcDir, entry.name)
45
55
  const d = path.join(dstDir, entry.name)
56
+ const relativePath = normalizeRelativePath(path.join(relativeDir, entry.name))
46
57
 
47
- // Skip excluded files
48
- if (excludeFiles.includes(entry.name)) {
58
+ // Skip excluded file paths (relative to platform source root)
59
+ if (excludeFiles.includes(relativePath)) {
49
60
  console.log(`[withCopyFiles] Skipped (excluded): ${s}`)
50
61
  continue
51
62
  }
52
63
 
53
64
  if (entry.isDirectory()) {
54
- copyDirRecursive(s, d, overwrite, excludeFiles)
65
+ copyDirRecursive(s, d, overwrite, excludeFiles, relativePath)
55
66
  } else {
56
67
  copyFile(s, d, overwrite)
57
68
  }
@@ -101,6 +112,7 @@ const withCopyFiles = (
101
112
  console.log('[withCopyFiles] Android stage (withProjectBuildGradle)')
102
113
 
103
114
  const projectRoot = cfg.modRequest.projectRoot
115
+ const dstBuildGradle = path.resolve(projectRoot, 'android', 'build.gradle')
104
116
  const srcBuildGradle = path.resolve(
105
117
  projectRoot,
106
118
  sourceDir,
@@ -110,11 +122,15 @@ const withCopyFiles = (
110
122
 
111
123
  // Special handling for build.gradle: update modResults.contents instead of direct file copy
112
124
  if (fs.existsSync(srcBuildGradle)) {
113
- const buildGradleContents = fs.readFileSync(srcBuildGradle, 'utf8')
114
- cfg.modResults.contents = buildGradleContents
115
- console.log(
116
- `[withCopyFiles] Updated build.gradle contents from: ${srcBuildGradle}`,
117
- )
125
+ if (!overwrite && fs.existsSync(dstBuildGradle)) {
126
+ console.log(`[withCopyFiles] Skipped (exists): ${dstBuildGradle}`)
127
+ } else {
128
+ const buildGradleContents = fs.readFileSync(srcBuildGradle, 'utf8')
129
+ cfg.modResults.contents = buildGradleContents
130
+ console.log(
131
+ `[withCopyFiles] Updated build.gradle contents from: ${srcBuildGradle}`,
132
+ )
133
+ }
118
134
  }
119
135
 
120
136
  // Copy other Android files (excluding build.gradle which is handled above)