@circle-fin/w3s-pw-react-native-sdk 1.0.2 → 1.0.4

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/COPYRIGHT.md ADDED
@@ -0,0 +1,10 @@
1
+ Copyright (c) 2024, Circle Technologies, LLC. All rights reserved.
2
+
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at <http://www.apache.org/licenses/LICENSE-2.0>
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
package/README.md CHANGED
@@ -1,5 +1,4 @@
1
1
  # @circle-fin/w3s-pw-react-native-sdk
2
-
3
2
  React Native SDK for Circle Programmable Wallet
4
3
  ## Install NVM
5
4
 
@@ -15,7 +15,7 @@ Pod::Spec.new do |s|
15
15
  s.source = { :git => package["repository"], :tag => "#{s.version}" }
16
16
 
17
17
  s.source_files = "ios/**/*.{h,m,mm,swift}"
18
- s.dependency 'CircleProgrammableWalletSDK', '1.0.14'
18
+ s.dependency 'CircleProgrammableWalletSDK', '1.0.15'
19
19
 
20
20
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
21
21
  # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
@@ -28,6 +28,7 @@ class ReactNativeEventEmitter: RCTEventEmitter {
28
28
  @objc override func supportedEvents() -> [String] {
29
29
  return EventEmitter.sharedInstance.allEvents
30
30
  }
31
+
31
32
  @objc override static func requiresMainQueueSetup() -> Bool {
32
33
  return true
33
34
  }
@@ -88,7 +88,7 @@ extension RNWalletSdk {
88
88
  guard let cell = cell as? SecurityQuestionTableViewCell else { continue }
89
89
 
90
90
  if let configs = self.sTextsMap[.securityQuestionHeaders],
91
- let config = configs[safe: i] { // A5
91
+ let config = configs[safe: i] { // A5
92
92
  self.setText(label: cell.questionTitleLabel, textConfig: config)
93
93
  }
94
94
  if let textConfig = self.sTextMap[.circlepw_security_questions_required_mark] { // C13
@@ -96,7 +96,7 @@ extension RNWalletSdk {
96
96
  self.setText(label: cell.answerMarkLabel, textConfig: textConfig)
97
97
  }
98
98
  if let textConfig = self.sTextMap[.circlepw_security_questions_question_placeholder],
99
- let label = cell.questionView.subviews.first as? UILabel { // C15
99
+ let label = cell.questionView.subviews.first as? UILabel { // C15
100
100
  self.setText(label: label, textConfig: textConfig)
101
101
  }
102
102
 
@@ -138,9 +138,8 @@ extension RNWalletSdk {
138
138
  if let textConfig = sTextMap[.circlepw_select_question_item_config] { // C25
139
139
  DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
140
140
  for cell in controller.tableView.visibleCells {
141
- // TODO: make SelectQuestionTableViewCell class public from SDK
142
- // guard let cell = cell as? SelectQuestionTableViewCell else { continue }
143
- // setText(label: cell.titleLabel, textConfig: textConfig, shouldReplaceText: false)
141
+ guard let cell = cell as? SelectQuestionTableViewCell else { continue }
142
+ self.setText(label: cell.titleLabel, textConfig: textConfig, shouldReplaceText: false)
144
143
  }
145
144
  }
146
145
  }
@@ -156,7 +155,7 @@ extension RNWalletSdk {
156
155
  guard let cell = cell as? SecuritySummaryTableViewCell else { continue }
157
156
 
158
157
  if let configs = self.sTextsMap[.securitySummaryQuestionHeaders],
159
- let config = configs[safe: i] { // A6
158
+ let config = configs[safe: i] { // A6
160
159
  self.setText(label: cell.titleLabel, textConfig: config)
161
160
  }
162
161
 
@@ -94,22 +94,22 @@ public class RNWalletSdk: NSObject {
94
94
  }
95
95
  }
96
96
 
97
- // TODO
98
97
  @objc public func executeWithUserSecret(_ userToken: String,
99
- encryptionKey: String,
100
- userSecret: String,
101
- challengeIds: NSArray,
102
- resolve: @escaping RCTPromiseResolveBlock,
103
- reject: @escaping RCTPromiseRejectBlock) {
98
+ encryptionKey: String,
99
+ userSecret: String,
100
+ challengeIds: NSArray,
101
+ resolve: @escaping RCTPromiseResolveBlock,
102
+ reject: @escaping RCTPromiseRejectBlock) {
104
103
  guard let challengeIdArr = challengeIds as? [String] else {
105
104
  reject(nil, "[unknown format] challengeIds", nil)
106
105
  return
107
106
  }
108
- // copied from execute()
107
+
109
108
  DispatchQueue.main.async {
110
- WalletSdk.shared.execute(userToken: userToken,
111
- encryptionKey: encryptionKey,
112
- challengeIds: challengeIdArr) { response in
109
+ WalletSdk.shared.executeWithUserSecret(userToken: userToken,
110
+ encryptionKey: encryptionKey,
111
+ userSecret: userSecret,
112
+ challengeIds: challengeIdArr) { response in
113
113
  switch response.result {
114
114
  case .success(let result):
115
115
  self._handleSuccessResult(result: result,
@@ -209,22 +209,10 @@ public class RNWalletSdk: NSObject {
209
209
  @objc public func setImageMap(_ map: NSDictionary) {
210
210
  for (key, value) in map {
211
211
  guard let key = key as? String,
212
- let value = value as? String else { continue }
213
-
214
- if let imgKey = BridgeHelper.getImageKey(rnKey: key) {
215
- if value.starts(with: "http") {
216
- sRemote[imgKey] = URL(string: value)
217
- } else {
218
- var url = URL(string: value)
219
- if let url = url {
220
- if #available(iOS 16.0, *) {
221
- sLocal[imgKey] = UIImage.init(contentsOfFile: url.path())
222
- } else {
223
- // TODO
224
- }
225
- }
226
- }
227
- }
212
+ let value = value as? String,
213
+ let imgUrl = URL(string: value),
214
+ let imgKey = BridgeHelper.getImageKey(rnKey: key) else { continue }
215
+ sRemote[imgKey] = imgUrl
228
216
  }
229
217
  }
230
218
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@circle-fin/w3s-pw-react-native-sdk",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "React Native SDK for Circle Programmable Wallet",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -13,6 +13,7 @@
13
13
  "android",
14
14
  "ios",
15
15
  "*.podspec",
16
+ "COPYRIGHT*",
16
17
  "!ios/build",
17
18
  "!android/build",
18
19
  "!android/gradle",
@@ -25,7 +26,7 @@
25
26
  "!**/.*"
26
27
  ],
27
28
  "scripts": {
28
- "example": "yarn workspace @circle-fin/programmablewallet-rn-sdk-example",
29
+ "example": "yarn workspace @circle-fin/w3s-pw-react-native-sdk-example",
29
30
  "test": "jest",
30
31
  "npm": "npm",
31
32
  "typecheck": "tsc --noEmit",
@@ -51,9 +52,9 @@
51
52
  "author": "Circle Inc.",
52
53
  "license": "Apache-2.0",
53
54
  "bugs": {
54
- "url": "https://github.com/circlefin/programmable-wallet-sdk-rn/issues"
55
+ "url": "https://github.com/circlefin/w3s-react-native-sdk/issues"
55
56
  },
56
- "homepage": "https://github.com/circlefin/programmable-wallet-sdk-rn#readme",
57
+ "homepage": "https://github.com/circlefin/w3s-react-native-sdk#readme",
57
58
  "publishConfig": {
58
59
  "access": "public",
59
60
  "registry": "https://registry.npmjs.org/"