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

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.
Files changed (114) hide show
  1. package/BARE_REACT_NATIVE_GUIDE.md +397 -0
  2. package/LICENSE +1 -1
  3. package/README.md +196 -90
  4. package/android/build.gradle +43 -126
  5. package/android/src/main/AndroidManifest.xml +12 -16
  6. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/ProgrammablewalletRnSdkModule.kt +414 -244
  7. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/PromiseCallback.kt +76 -74
  8. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/RecordsHelper.kt +602 -0
  9. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/models/Records.kt +43 -0
  10. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/pwcustom/RnImageSetter.kt +55 -33
  11. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/pwcustom/RnLayoutProvider.kt +81 -79
  12. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/pwcustom/RnViewSetterProvider.kt +93 -63
  13. package/app.json +8 -0
  14. package/build/ProgrammablewalletRnSdkModule.d.ts +44 -0
  15. package/build/ProgrammablewalletRnSdkModule.d.ts.map +1 -0
  16. package/build/ProgrammablewalletRnSdkModule.js +21 -0
  17. package/build/ProgrammablewalletRnSdkModule.js.map +1 -0
  18. package/build/WalletSdk.d.ts +20 -0
  19. package/build/WalletSdk.d.ts.map +1 -0
  20. package/build/WalletSdk.js +303 -0
  21. package/build/WalletSdk.js.map +1 -0
  22. package/build/bridgeSafe.d.ts +50 -0
  23. package/build/bridgeSafe.d.ts.map +1 -0
  24. package/build/bridgeSafe.js +136 -0
  25. package/build/bridgeSafe.js.map +1 -0
  26. package/build/index.d.ts +21 -0
  27. package/build/index.d.ts.map +1 -0
  28. package/build/index.js +21 -0
  29. package/build/index.js.map +1 -0
  30. package/{lib/typescript/src → build}/types.d.ts +72 -43
  31. package/build/types.d.ts.map +1 -0
  32. package/build/types.js +331 -0
  33. package/build/types.js.map +1 -0
  34. package/build/utils/securityQuestionUtils.d.ts +43 -0
  35. package/build/utils/securityQuestionUtils.d.ts.map +1 -0
  36. package/build/utils/securityQuestionUtils.js +109 -0
  37. package/build/utils/securityQuestionUtils.js.map +1 -0
  38. package/expo-module.config.json +11 -0
  39. package/ios/Array+Extension.swift +17 -15
  40. package/ios/BridgeHelper.swift +71 -92
  41. package/ios/{RnWalletSdk+CustomizeAdapter.swift → CustomizeAdapter.swift} +19 -29
  42. package/ios/ProgrammablewalletRnSdk.podspec +30 -0
  43. package/ios/ProgrammablewalletRnSdkModule.swift +384 -0
  44. package/ios/TextConfig.swift +17 -15
  45. package/ios/TextKey.swift +17 -15
  46. package/ios/UIApplication+Extension.swift +26 -17
  47. package/ios/UIColor+Extension.swift +34 -28
  48. package/ios/UITextField+Extension.swift +31 -0
  49. package/ios/UIView+Extension.swift +24 -17
  50. package/package.json +70 -116
  51. package/plugins/apple-signin-entitlements.js +16 -0
  52. package/plugins/infoplist-config.js +77 -0
  53. package/plugins/infoplist-config.md +72 -0
  54. package/plugins/podfile-modifier.js +84 -0
  55. package/plugins/podfile-modifier.md +33 -0
  56. package/plugins/withCopyFiles.js +132 -0
  57. package/plugins/withCopyFiles.md +81 -0
  58. package/src/ProgrammablewalletRnSdkModule.ts +68 -38
  59. package/src/WalletSdk.ts +297 -159
  60. package/src/bridgeSafe.ts +156 -0
  61. package/src/index.ts +21 -0
  62. package/src/types.ts +133 -110
  63. package/src/utils/securityQuestionUtils.ts +121 -0
  64. package/COPYRIGHT +0 -10
  65. package/android/gradle.properties +0 -21
  66. package/android/src/main/AndroidManifestNew.xml +0 -22
  67. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/BridgeHelper.kt +0 -399
  68. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/ProgrammablewalletRnSdkPackage.kt +0 -49
  69. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/PromiseCallback2.kt +0 -65
  70. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/PromiseLogoutCallback.kt +0 -47
  71. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/PromiseSocialCallback.kt +0 -53
  72. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/TestHelper.kt +0 -37
  73. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/annotation/ExcludeFromGeneratedCCReport.kt +0 -33
  74. package/android/src/newarch/ProgrammablewalletRnSdkSpec.kt +0 -29
  75. package/android/src/oldarch/ProgrammablewalletRnSdkSpec.kt +0 -76
  76. package/circlefin-w3s-pw-react-native-sdk.podspec +0 -41
  77. package/ios/EventEmitter.swift +0 -49
  78. package/ios/ProgrammablewalletRnSdk.h +0 -29
  79. package/ios/ProgrammablewalletRnSdk.mm +0 -162
  80. package/ios/ReactNativeEventEmitter.m +0 -27
  81. package/ios/ReactNativeEventEmitter.swift +0 -37
  82. package/ios/RnWalletSdk.swift +0 -390
  83. package/ios/programmablewallet-rn-sdk-Bridging-Header.h +0 -22
  84. package/lib/commonjs/NativeProgrammablewalletRnSdk.js +0 -24
  85. package/lib/commonjs/NativeProgrammablewalletRnSdk.js.map +0 -1
  86. package/lib/commonjs/ProgrammablewalletRnSdkModule.js +0 -38
  87. package/lib/commonjs/ProgrammablewalletRnSdkModule.js.map +0 -1
  88. package/lib/commonjs/WalletSdk.js +0 -211
  89. package/lib/commonjs/WalletSdk.js.map +0 -1
  90. package/lib/commonjs/index.js +0 -74
  91. package/lib/commonjs/index.js.map +0 -1
  92. package/lib/commonjs/types.js +0 -342
  93. package/lib/commonjs/types.js.map +0 -1
  94. package/lib/module/NativeProgrammablewalletRnSdk.js +0 -19
  95. package/lib/module/NativeProgrammablewalletRnSdk.js.map +0 -1
  96. package/lib/module/ProgrammablewalletRnSdkModule.js +0 -31
  97. package/lib/module/ProgrammablewalletRnSdkModule.js.map +0 -1
  98. package/lib/module/WalletSdk.js +0 -203
  99. package/lib/module/WalletSdk.js.map +0 -1
  100. package/lib/module/index.js +0 -18
  101. package/lib/module/index.js.map +0 -1
  102. package/lib/module/types.js +0 -334
  103. package/lib/module/types.js.map +0 -1
  104. package/lib/typescript/src/NativeProgrammablewalletRnSdk.d.ts +0 -28
  105. package/lib/typescript/src/NativeProgrammablewalletRnSdk.d.ts.map +0 -1
  106. package/lib/typescript/src/ProgrammablewalletRnSdkModule.d.ts +0 -3
  107. package/lib/typescript/src/ProgrammablewalletRnSdkModule.d.ts.map +0 -1
  108. package/lib/typescript/src/WalletSdk.d.ts +0 -3
  109. package/lib/typescript/src/WalletSdk.d.ts.map +0 -1
  110. package/lib/typescript/src/index.d.ts +0 -4
  111. package/lib/typescript/src/index.d.ts.map +0 -1
  112. package/lib/typescript/src/types.d.ts.map +0 -1
  113. package/src/NativeProgrammablewalletRnSdk.ts +0 -77
  114. package/src/index.tsx +0 -29
@@ -1,42 +1,64 @@
1
- // Copyright (c) 2024, Circle Internet Financial, LTD. All rights reserved.
2
- //
3
- // SPDX-License-Identifier: Apache-2.0
4
- //
5
- // Licensed under the Apache License, Version 2.0 (the "License");
6
- // you may not use this file except in compliance with the License.
7
- // You may obtain a copy of the License at
8
- //
9
- // http://www.apache.org/licenses/LICENSE-2.0
10
- //
11
- // Unless required by applicable law or agreed to in writing, software
12
- // distributed under the License is distributed on an "AS IS" BASIS,
13
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- // See the License for the specific language governing permissions and
15
- // limitations under the License.
1
+ /**
2
+ * Copyright 2025 Circle Internet Group, Inc. All rights reserved.
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
16
18
  package com.circlefin.programmablewalletrnsdk.pwcustom
17
19
 
20
+ import android.util.Log
18
21
  import android.widget.ImageView
19
22
  import circle.programmablewallet.sdk.presentation.IImageViewSetter
20
23
  import com.bumptech.glide.Glide
21
- import com.circlefin.programmablewalletrnsdk.TestHelper
24
+ import com.bumptech.glide.load.engine.DiskCacheStrategy
22
25
 
23
26
  class RnImageSetter(val value: String?) : IImageViewSetter {
24
- override fun apply(iv: ImageView?) {
25
- try {
26
- iv ?: return
27
- value ?: return
28
- val context = iv.context
29
- if (value.startsWith("http")) {
30
- Glide.with(context).load(value).centerCrop().into(iv)
31
- TestHelper.addTagForTest(iv, value)
32
- } else {
33
- val resourceId =
34
- context.resources.getIdentifier(value, "drawable", context.packageName)
35
- iv.setImageResource(resourceId)
36
- TestHelper.addTagForTest(iv, "$resourceId")
37
- }
38
- } catch (e: Exception) {
39
- e.printStackTrace()
27
+ override fun apply(iv: ImageView?) {
28
+ try {
29
+ iv ?: return
30
+ value ?: return
31
+ val context = iv.context
32
+
33
+ if (value.startsWith("http")) {
34
+ try {
35
+ Glide.with(context)
36
+ .load(value)
37
+ .diskCacheStrategy(DiskCacheStrategy.ALL)
38
+ .into(iv)
39
+ } catch (glideException: Exception) {
40
+ Log.e("RnImageSetter", "Glide failed to load: $value", glideException)
41
+ }
42
+ TestHelper.addTagForTest(iv, value)
43
+ } else {
44
+ val resourceId = context.resources.getIdentifier(value, "drawable", context.packageName)
45
+ if (resourceId != 0) {
46
+ iv.setImageResource(resourceId)
47
+ TestHelper.addTagForTest(iv, "$resourceId")
48
+ } else {
49
+ Log.w("RnImageSetter", "Local resource not found: $value")
50
+ }
51
+ }
52
+ } catch (e: Exception) {
53
+ Log.e("RnImageSetter", "Exception in apply()", e)
54
+ e.printStackTrace()
55
+ }
56
+ }
57
+ }
58
+
59
+ object TestHelper {
60
+ @JvmStatic
61
+ fun addTagForTest(view: ImageView, tag: String) {
62
+ view.tag = tag
40
63
  }
41
- }
42
64
  }
@@ -1,18 +1,21 @@
1
- // Copyright (c) 2024, Circle Internet Financial, LTD. All rights reserved.
2
- //
3
- // SPDX-License-Identifier: Apache-2.0
4
- //
5
- // Licensed under the Apache License, Version 2.0 (the "License");
6
- // you may not use this file except in compliance with the License.
7
- // You may obtain a copy of the License at
8
- //
9
- // http://www.apache.org/licenses/LICENSE-2.0
10
- //
11
- // Unless required by applicable law or agreed to in writing, software
12
- // distributed under the License is distributed on an "AS IS" BASIS,
13
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- // See the License for the specific language governing permissions and
15
- // limitations under the License.
1
+ /**
2
+ * Copyright 2025 Circle Internet Group, Inc. All rights reserved.
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
16
19
  package com.circlefin.programmablewalletrnsdk.pwcustom
17
20
 
18
21
  import circle.programmablewallet.sdk.api.ApiError
@@ -20,72 +23,71 @@ import circle.programmablewallet.sdk.presentation.IconTextConfig
20
23
  import circle.programmablewallet.sdk.presentation.LayoutProvider
21
24
  import circle.programmablewallet.sdk.presentation.Resource
22
25
  import circle.programmablewallet.sdk.presentation.TextConfig
23
- import com.circlefin.programmablewalletrnsdk.annotation.ExcludeFromGeneratedCCReport
24
26
  import java.util.Locale
25
27
 
26
28
  object RnLayoutProvider : LayoutProvider() {
27
- val textConfigsMap: MutableMap<String, Array<TextConfig?>> = HashMap()
28
- val textConfigMap: MutableMap<String, TextConfig> = HashMap()
29
- val iconTextsMap: MutableMap<Resource.IconTextsKey, Array<IconTextConfig?>> = HashMap()
30
- val errorStringMap: MutableMap<Int, String> = HashMap()
31
- @ExcludeFromGeneratedCCReport
32
- var _dateFormat: String? = null
33
- @ExcludeFromGeneratedCCReport
34
- var _debugging = true
35
- fun setTextConfigsMap(textConfigsMap: Map<String, Array<TextConfig?>>) {
36
- this.textConfigsMap.clear()
37
- this.textConfigsMap.putAll(textConfigsMap)
38
- }
39
-
40
- fun setErrorStringMap(errorStringMap: Map<Int, String>) {
41
- this.errorStringMap.clear()
42
- this.errorStringMap.putAll(errorStringMap)
43
- }
44
-
45
- fun setTextConfigMap(textConfigMap: Map<String, TextConfig>) {
46
- this.textConfigMap.clear()
47
- this.textConfigMap.putAll(textConfigMap)
48
- }
49
-
50
- fun setIconTextConfigsMap(textConfigsMap: Map<Resource.IconTextsKey, Array<IconTextConfig?>>) {
51
- iconTextsMap.clear()
52
- iconTextsMap.putAll(textConfigsMap)
53
- }
54
-
55
- fun setDateFormat(format: String?) {
56
- format?.let {
57
- _dateFormat = it.uppercase(Locale.getDefault())
29
+ val textConfigsMap: MutableMap<String, Array<TextConfig?>> = HashMap()
30
+ val textConfigMap: MutableMap<String, TextConfig> = HashMap()
31
+ val iconTextsMap: MutableMap<Resource.IconTextsKey, Array<IconTextConfig?>> = HashMap()
32
+ val errorStringMap: MutableMap<Int, String> = HashMap()
33
+
34
+ var _dateFormat: String? = null
35
+
36
+ var _debugging = true
37
+ fun setTextConfigsMap(textConfigsMap: Map<String, Array<TextConfig?>>) {
38
+ this.textConfigsMap.clear()
39
+ this.textConfigsMap.putAll(textConfigsMap)
40
+ }
41
+
42
+ fun setErrorStringMap(errorStringMap: Map<Int, String>) {
43
+ this.errorStringMap.clear()
44
+ this.errorStringMap.putAll(errorStringMap)
45
+ }
46
+
47
+ fun setTextConfigMap(textConfigMap: Map<String, TextConfig>) {
48
+ this.textConfigMap.clear()
49
+ this.textConfigMap.putAll(textConfigMap)
50
+ }
51
+
52
+ fun setIconTextConfigsMap(textConfigsMap: Map<Resource.IconTextsKey, Array<IconTextConfig?>>) {
53
+ iconTextsMap.clear()
54
+ iconTextsMap.putAll(textConfigsMap)
55
+ }
56
+
57
+ fun setDateFormat(format: String?) {
58
+ format?.let {
59
+ _dateFormat = it.uppercase(Locale.getDefault())
60
+ }
61
+ }
62
+
63
+ fun setDebugging(debugging: Boolean) {
64
+ this._debugging = debugging
65
+ }
66
+
67
+ override fun getTextConfig(key: String): TextConfig? {
68
+ return textConfigMap[key] ?: return super.getTextConfig(key)
69
+ }
70
+
71
+ override fun getIconTextConfigs(key: Resource.IconTextsKey): Array<IconTextConfig?>? {
72
+ return iconTextsMap[key]
73
+ ?: return super.getIconTextConfigs(key)
74
+ }
75
+
76
+ override fun getTextConfigs(key: Resource.TextsKey): Array<TextConfig?>? {
77
+ return textConfigsMap[key.name] ?: return super.getTextConfigs(key)
78
+ }
79
+
80
+ override fun getErrorString(code: ApiError.ErrorCode): String? {
81
+ return errorStringMap[code.value] ?: super.getErrorString(code)
82
+ }
83
+
84
+ override fun getDateFormat(): String? {
85
+ return if (_dateFormat == null) {
86
+ super.getDateFormat()
87
+ } else _dateFormat
88
+ }
89
+
90
+ override fun isDebugging(): Boolean {
91
+ return _debugging
58
92
  }
59
- }
60
-
61
- fun setDebugging(debugging: Boolean) {
62
- this._debugging = debugging
63
- }
64
-
65
- override fun getTextConfig(key: String): TextConfig? {
66
- return textConfigMap[key] ?: return super.getTextConfig(key)
67
- }
68
-
69
- override fun getIconTextConfigs(key: Resource.IconTextsKey): Array<IconTextConfig?>? {
70
- return iconTextsMap[key]
71
- ?: return super.getIconTextConfigs(key)
72
- }
73
-
74
- override fun getTextConfigs(key: Resource.TextsKey): Array<TextConfig?>? {
75
- return textConfigsMap[key.name] ?: return super.getTextConfigs(key)
76
- }
77
-
78
- override fun getErrorString(code: ApiError.ErrorCode): String? {
79
- return errorStringMap[code.value] ?: super.getErrorString(code)
80
- }
81
-
82
- override fun getDateFormat(): String? {
83
- return if (_dateFormat == null) {
84
- super.getDateFormat()
85
- } else _dateFormat
86
- }
87
-
88
- override fun isDebugging(): Boolean {
89
- return _debugging
90
- }
91
93
  }
@@ -1,77 +1,107 @@
1
- // Copyright (c) 2024, Circle Internet Financial, LTD. All rights reserved.
2
- //
3
- // SPDX-License-Identifier: Apache-2.0
4
- //
5
- // Licensed under the Apache License, Version 2.0 (the "License");
6
- // you may not use this file except in compliance with the License.
7
- // You may obtain a copy of the License at
8
- //
9
- // http://www.apache.org/licenses/LICENSE-2.0
10
- //
11
- // Unless required by applicable law or agreed to in writing, software
12
- // distributed under the License is distributed on an "AS IS" BASIS,
13
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- // See the License for the specific language governing permissions and
15
- // limitations under the License.
1
+ /**
2
+ * Copyright 2025 Circle Internet Group, Inc. All rights reserved.
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
16
19
  package com.circlefin.programmablewalletrnsdk.pwcustom
17
20
 
18
- import android.graphics.drawable.Drawable
19
- import androidx.appcompat.widget.Toolbar
21
+ import android.content.Context
22
+ import android.util.Log
20
23
  import circle.programmablewallet.sdk.presentation.IImageViewSetter
21
24
  import circle.programmablewallet.sdk.presentation.IToolbarSetter
25
+ import circle.programmablewallet.sdk.presentation.LocalToolbarImageSetter
26
+ import circle.programmablewallet.sdk.presentation.RemoteToolbarImageSetter
22
27
  import circle.programmablewallet.sdk.presentation.Resource
23
28
  import circle.programmablewallet.sdk.presentation.ViewSetterProvider
24
- import com.bumptech.glide.Glide
25
- import com.bumptech.glide.request.target.CustomTarget
26
- import com.bumptech.glide.request.transition.Transition
27
- import com.circlefin.programmablewalletrnsdk.TestHelper
28
29
 
30
+ /**
31
+ * Custom ViewSetterProvider for React Native SDK image customization.
32
+ * This is the correct way to implement image customization in Circle SDK.
33
+ *
34
+ * Handles both regular icons and toolbar icons (back, close buttons).
35
+ */
29
36
  object RnViewSetterProvider : ViewSetterProvider() {
30
- val map: MutableMap<String, String> = HashMap()
31
- fun setMap(map: Map<String, String>) {
32
- this.map.clear()
33
- this.map.putAll(map)
34
- }
35
37
 
36
- override fun getImageSetter(icon: Resource.Icon): IImageViewSetter {
37
- val key = String.format("%s", icon.name)
38
- val value = map[key]
39
- return RnImageSetter(value)
40
- }
38
+ // Store image mappings for different icons
39
+ private val imageMap: MutableMap<String, String> = HashMap()
40
+ // Store context for resource lookups
41
+ private var context: Context? = null
41
42
 
42
- override fun getToolbarImageSetter(toolbarIcon: Resource.ToolbarIcon): IToolbarSetter {
43
- return object : IToolbarSetter {
44
- override fun apply(toolbar: Toolbar?) {
45
- try {
46
- if (toolbar == null) {
47
- return
48
- }
49
- val context = toolbar.context
50
- val key = String.format("%s", toolbarIcon.name)
51
- val value = map[key] ?: return
52
- if (value.startsWith("http")) {
53
- Glide.with(context).asDrawable().load(value)
54
- .into(object : CustomTarget<Drawable?>() {
55
- override fun onResourceReady(
56
- resource: Drawable,
57
- transition: Transition<in Drawable?>?
58
- ) {
59
- toolbar.navigationIcon = resource
60
- }
43
+ /**
44
+ * Set custom image mappings.
45
+ * @param map Map of icon names to image URLs/paths
46
+ * @param context Android context for resource lookups
47
+ */
48
+ fun setImageMap(map: Map<String, String>, context: Context? = null) {
49
+ imageMap.clear()
50
+ imageMap.putAll(map)
51
+ if (context != null) {
52
+ this.context = context
53
+ }
54
+ }
61
55
 
62
- override fun onLoadCleared(placeholder: Drawable?) {}
63
- })
64
- TestHelper.addTagForTest(toolbar, value)
65
- } else {
66
- val resourceId =
67
- context.resources.getIdentifier(value, "drawable", context.packageName)
68
- toolbar.setNavigationIcon(resourceId)
69
- TestHelper.addTagForTest(toolbar, "$resourceId")
70
- }
71
- } catch (e: Exception) {
72
- e.printStackTrace()
56
+ /**
57
+ * Return custom IImageViewSetter for the given icon type.
58
+ * This is called by the SDK when it needs to set an image.
59
+ */
60
+ override fun getImageSetter(type: Resource.Icon): IImageViewSetter? {
61
+ val imageUrl = imageMap[type.name]
62
+ return if (imageUrl != null) {
63
+ // Use our custom RnImageSetter for both remote and local images
64
+ RnImageSetter(imageUrl)
65
+ } else {
66
+ // Fallback to default behavior
67
+ super.getImageSetter(type)
68
+ }
69
+ }
70
+
71
+ /**
72
+ * Return custom IToolbarSetter for toolbar icons (back, close).
73
+ * This handles navigation buttons in the toolbar.
74
+ */
75
+ override fun getToolbarImageSetter(type: Resource.ToolbarIcon): IToolbarSetter? {
76
+ val imageUrl = imageMap[type.name]
77
+ return if (imageUrl != null) {
78
+ if (imageUrl.startsWith("http") || imageUrl.startsWith("data:")) {
79
+ // Remote image or data URI - use RemoteToolbarImageSetter
80
+ RemoteToolbarImageSetter(0, imageUrl)
81
+ } else {
82
+ // Local drawable resource name - use LocalToolbarImageSetter
83
+ val ctx = context
84
+ if (ctx != null) {
85
+ try {
86
+ val resourceId = ctx.resources.getIdentifier(imageUrl, "drawable", ctx.packageName)
87
+ if (resourceId != 0) {
88
+ LocalToolbarImageSetter(resourceId)
89
+ } else {
90
+ Log.w("RnViewSetterProvider", "Could not find drawable resource: $imageUrl, falling back to RemoteToolbarImageSetter")
91
+ RemoteToolbarImageSetter(0, imageUrl)
92
+ }
93
+ } catch (e: Exception) {
94
+ Log.e("RnViewSetterProvider", "Failed to create LocalToolbarImageSetter for: $imageUrl", e)
95
+ RemoteToolbarImageSetter(0, imageUrl)
96
+ }
97
+ } else {
98
+ Log.w("RnViewSetterProvider", "No context available for local resource: $imageUrl, using RemoteToolbarImageSetter")
99
+ RemoteToolbarImageSetter(0, imageUrl)
100
+ }
101
+ }
102
+ } else {
103
+ // Fallback to default behavior
104
+ super.getToolbarImageSetter(type)
73
105
  }
74
- }
75
106
  }
76
- }
77
107
  }
package/app.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "android": {
3
+ "package": "com.anonymous.circlefinw3spwreactnativesdk"
4
+ },
5
+ "ios": {
6
+ "bundleIdentifier": "com.anonymous.circlefinw3spwreactnativesdk"
7
+ }
8
+ }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Copyright 2025 Circle Internet Group, Inc. All rights reserved.
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ import { NativeModule } from 'expo-modules-core';
19
+ import { ProgrammablewalletRnSdkModuleEvents, Configuration, DateFormat, SuccessResult, LoginResult, SecurityQuestion, TextConfig } from './types';
20
+ declare class ProgrammablewalletRnSdkModule extends NativeModule<ProgrammablewalletRnSdkModuleEvents> {
21
+ sdkVersion: string;
22
+ getDeviceId(): string;
23
+ initSdk(configuration: Configuration): Promise<void>;
24
+ setSecurityQuestions(securityQuestions: SecurityQuestion[]): void;
25
+ execute(userToken: string | null, encryptionKey: string | null, challengeIds: string[]): Promise<SuccessResult>;
26
+ verifyOTP(otpToken: string | null, deviceToken: string | null, deviceEncryptionKey: string | null): Promise<LoginResult>;
27
+ performLogin(provider: string, deviceToken: string, deviceEncryptionKey: string): Promise<LoginResult>;
28
+ performLogout(provider: string): Promise<void>;
29
+ setBiometricsPin(userToken: string | null, encryptionKey: string | null): Promise<SuccessResult>;
30
+ setDismissOnCallbackMap(map: Record<string, boolean>): void;
31
+ moveTaskToFront(): void;
32
+ moveRnTaskToFront(): void;
33
+ setTextConfigsMap(map: Record<string, unknown[]>): void;
34
+ setIconTextConfigsMap(map: Record<string, unknown>): void;
35
+ setTextConfigMap(map: Record<string, TextConfig>): void;
36
+ setImageMap(map: Record<string, string>): void;
37
+ setDateFormat(format: DateFormat): void;
38
+ setDebugging(debugging: boolean): void;
39
+ setCustomUserAgent(userAgent: string): void;
40
+ setErrorStringMap(map: Record<string, string>): void;
41
+ }
42
+ declare const _default: ProgrammablewalletRnSdkModule;
43
+ export default _default;
44
+ //# sourceMappingURL=ProgrammablewalletRnSdkModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProgrammablewalletRnSdkModule.d.ts","sourceRoot":"","sources":["../src/ProgrammablewalletRnSdkModule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,YAAY,EAAuB,MAAM,mBAAmB,CAAA;AACrE,OAAO,EACL,mCAAmC,EACnC,aAAa,EACb,UAAU,EACV,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,UAAU,EACX,MAAM,SAAS,CAAA;AAEhB,OAAO,OAAO,6BAA8B,SAAQ,YAAY,CAAC,mCAAmC,CAAC;IACnG,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,IAAI,MAAM;IACrB,OAAO,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IACpD,oBAAoB,CAAC,iBAAiB,EAAE,gBAAgB,EAAE,GAAG,IAAI;IACjE,OAAO,CACL,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,aAAa,EAAE,MAAM,GAAG,IAAI,EAC5B,YAAY,EAAE,MAAM,EAAE,GACrB,OAAO,CAAC,aAAa,CAAC;IACzB,SAAS,CACP,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,WAAW,EAAE,MAAM,GAAG,IAAI,EAC1B,mBAAmB,EAAE,MAAM,GAAG,IAAI,GACjC,OAAO,CAAC,WAAW,CAAC;IACvB,YAAY,CACV,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,mBAAmB,EAAE,MAAM,GAC1B,OAAO,CAAC,WAAW,CAAC;IACvB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAC9C,gBAAgB,CACd,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,aAAa,EAAE,MAAM,GAAG,IAAI,GAC3B,OAAO,CAAC,aAAa,CAAC;IACzB,uBAAuB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAC3D,eAAe,IAAI,IAAI;IACvB,iBAAiB,IAAI,IAAI;IACzB,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI;IACvD,qBAAqB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IACzD,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,IAAI;IACvD,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAC9C,aAAa,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IACvC,YAAY,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI;IACtC,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAC3C,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;CACrD;;AAGD,wBAEC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Copyright 2025 Circle Internet Group, Inc. All rights reserved.
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ import { requireNativeModule } from 'expo-modules-core';
19
+ // This call loads the native module object from the JSI.
20
+ export default requireNativeModule('ProgrammablewalletRnSdk');
21
+ //# sourceMappingURL=ProgrammablewalletRnSdkModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProgrammablewalletRnSdkModule.js","sourceRoot":"","sources":["../src/ProgrammablewalletRnSdkModule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAgB,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAiDrE,yDAAyD;AACzD,eAAe,mBAAmB,CAChC,yBAAyB,CAC1B,CAAA","sourcesContent":["/**\n * Copyright 2025 Circle Internet Group, Inc. All rights reserved.\n *\n * SPDX-License-Identifier: Apache-2.0\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NativeModule, requireNativeModule } from 'expo-modules-core'\nimport {\n ProgrammablewalletRnSdkModuleEvents,\n Configuration,\n DateFormat,\n SuccessResult,\n LoginResult,\n SecurityQuestion,\n TextConfig,\n} from './types'\n\ndeclare class ProgrammablewalletRnSdkModule extends NativeModule<ProgrammablewalletRnSdkModuleEvents> {\n sdkVersion: string\n getDeviceId(): string\n initSdk(configuration: Configuration): Promise<void>\n setSecurityQuestions(securityQuestions: SecurityQuestion[]): void\n execute(\n userToken: string | null,\n encryptionKey: string | null,\n challengeIds: string[],\n ): Promise<SuccessResult>\n verifyOTP(\n otpToken: string | null,\n deviceToken: string | null,\n deviceEncryptionKey: string | null,\n ): Promise<LoginResult>\n performLogin(\n provider: string,\n deviceToken: string,\n deviceEncryptionKey: string,\n ): Promise<LoginResult>\n performLogout(provider: string): Promise<void>\n setBiometricsPin(\n userToken: string | null,\n encryptionKey: string | null,\n ): Promise<SuccessResult>\n setDismissOnCallbackMap(map: Record<string, boolean>): void\n moveTaskToFront(): void\n moveRnTaskToFront(): void\n setTextConfigsMap(map: Record<string, unknown[]>): void\n setIconTextConfigsMap(map: Record<string, unknown>): void\n setTextConfigMap(map: Record<string, TextConfig>): void\n setImageMap(map: Record<string, string>): void\n setDateFormat(format: DateFormat): void\n setDebugging(debugging: boolean): void\n setCustomUserAgent(userAgent: string): void\n setErrorStringMap(map: Record<string, string>): void\n}\n\n// This call loads the native module object from the JSI.\nexport default requireNativeModule<ProgrammablewalletRnSdkModule>(\n 'ProgrammablewalletRnSdk',\n)\n"]}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright 2025 Circle Internet Group, Inc. All rights reserved.
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ import { IWalletSdk } from './types';
19
+ export declare const WalletSdk: IWalletSdk;
20
+ //# sourceMappingURL=WalletSdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WalletSdk.d.ts","sourceRoot":"","sources":["../src/WalletSdk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,UAAU,EAmBX,MAAM,SAAS,CAAA;AAmChB,eAAO,MAAM,SAAS,YAmUlB,CAAA"}