@stripe/stripe-react-native 0.39.0 → 0.41.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 (62) hide show
  1. package/CHANGELOG.md +20 -3
  2. package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +13 -0
  3. package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +0 -60
  4. package/ios/CardFieldView.swift +0 -17
  5. package/ios/StripeSdk+PaymentSheet.swift +9 -0
  6. package/ios/StripeSdk.swift +29 -66
  7. package/lib/commonjs/components/AddToWalletButton.js +1 -1
  8. package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
  9. package/lib/commonjs/components/AddressSheet.js +1 -1
  10. package/lib/commonjs/components/AddressSheet.js.map +1 -1
  11. package/lib/commonjs/components/AuBECSDebitForm.js +1 -1
  12. package/lib/commonjs/components/AuBECSDebitForm.js.map +1 -1
  13. package/lib/commonjs/components/CardField.js +1 -1
  14. package/lib/commonjs/components/CardField.js.map +1 -1
  15. package/lib/commonjs/components/CardForm.js +1 -1
  16. package/lib/commonjs/components/CardForm.js.map +1 -1
  17. package/lib/commonjs/components/CustomerSheet.js +1 -1
  18. package/lib/commonjs/components/CustomerSheet.js.map +1 -1
  19. package/lib/commonjs/components/PlatformPayButton.js +1 -1
  20. package/lib/commonjs/components/PlatformPayButton.js.map +1 -1
  21. package/lib/commonjs/components/StripeContainer.js +1 -1
  22. package/lib/commonjs/components/StripeContainer.js.map +1 -1
  23. package/lib/commonjs/types/PaymentSheet.js +1 -1
  24. package/lib/commonjs/types/PaymentSheet.js.map +1 -1
  25. package/lib/commonjs/types/index.js +1 -1
  26. package/lib/commonjs/types/index.js.map +1 -1
  27. package/lib/module/components/AddToWalletButton.js +1 -1
  28. package/lib/module/components/AddToWalletButton.js.map +1 -1
  29. package/lib/module/components/AddressSheet.js +1 -1
  30. package/lib/module/components/AddressSheet.js.map +1 -1
  31. package/lib/module/components/AuBECSDebitForm.js +1 -1
  32. package/lib/module/components/AuBECSDebitForm.js.map +1 -1
  33. package/lib/module/components/CardField.js +1 -1
  34. package/lib/module/components/CardField.js.map +1 -1
  35. package/lib/module/components/CardForm.js +1 -1
  36. package/lib/module/components/CardForm.js.map +1 -1
  37. package/lib/module/components/CustomerSheet.js +1 -1
  38. package/lib/module/components/CustomerSheet.js.map +1 -1
  39. package/lib/module/components/PlatformPayButton.js +1 -1
  40. package/lib/module/components/PlatformPayButton.js.map +1 -1
  41. package/lib/module/components/StripeContainer.js +1 -1
  42. package/lib/module/components/StripeContainer.js.map +1 -1
  43. package/lib/module/types/PaymentSheet.js +1 -1
  44. package/lib/module/types/PaymentSheet.js.map +1 -1
  45. package/lib/module/types/index.js +1 -1
  46. package/lib/module/types/index.js.map +1 -1
  47. package/lib/typescript/src/components/CustomerSheet.d.ts +3 -3
  48. package/lib/typescript/src/types/PaymentSheet.d.ts +21 -0
  49. package/lib/typescript/src/types/index.d.ts +1 -0
  50. package/package.json +3 -2
  51. package/src/components/CustomerSheet.tsx +3 -3
  52. package/src/types/PaymentSheet.ts +24 -0
  53. package/src/types/index.ts +1 -0
  54. package/stripe-react-native.podspec +1 -1
  55. package/android/.gradle/8.9/checksums/checksums.lock +0 -0
  56. package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
  57. package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
  58. package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
  59. package/android/.gradle/8.9/gc.properties +0 -0
  60. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  61. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  62. package/android/.gradle/vcs-1/gc.properties +0 -0
package/CHANGELOG.md CHANGED
@@ -1,6 +1,23 @@
1
1
  # CHANGELOG
2
2
 
3
- ## Unreleased
3
+ ## 0.41.0 - 2024-12-19
4
+
5
+ **Fixes**
6
+
7
+ - Updated `stripe-ios` to 24.2.\*
8
+
9
+ ## 0.40.0 - 2024-11-19
10
+
11
+ **Breaking changes**
12
+
13
+ - Removed support for FPX payments via the bank picker UI. If you'd like to accept FPX payments, we recommend using [Mobile Payment Element](https://docs.stripe.com/payments/accept-a-payment?platform=react-native). Also see the [FPX Payment guide](https://docs.stripe.com/payments/fpx/accept-a-payment?web-or-mobile=mobile) for more info on how to integrate FPX specifically.
14
+
15
+ **Features**
16
+
17
+ - `CustomerSheet` is now generally available!
18
+ - If you were using `CustomerSheetBeta`, change that to `CustomerSheet`.
19
+ - If you were using `CustomerSheetBeta.CustomerSheet`, change that to `CustomerSheet.Component`
20
+ - Enabled vertical mode
4
21
 
5
22
  ## 0.39.0 - 2024-10-15
6
23
 
@@ -11,8 +28,8 @@
11
28
 
12
29
  **Fixes**
13
30
 
14
- * Updated `stripe-ios` to 23.30.\*
15
- * Updated `stripe-android` to 20.52.\*
31
+ - Updated `stripe-ios` to 23.30.\*
32
+ - Updated `stripe-android` to 20.52.\*
16
33
 
17
34
  ## 0.38.6 - 2024-09-04
18
35
 
@@ -55,6 +55,7 @@ class PaymentSheetFragment(
55
55
  }
56
56
  }
57
57
 
58
+ @OptIn(ExperimentalPaymentMethodLayoutApi::class)
58
59
  override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
59
60
  super.onViewCreated(view, savedInstanceState)
60
61
  val merchantDisplayName = arguments?.getString("merchantDisplayName").orEmpty()
@@ -209,6 +210,10 @@ class PaymentSheetFragment(
209
210
  configurationBuilder.paymentMethodOrder(it)
210
211
  }
211
212
 
213
+ configurationBuilder.paymentMethodLayout(
214
+ mapToPaymentMethodLayout(arguments?.getString("paymentMethodLayout"))
215
+ )
216
+
212
217
  paymentSheetConfiguration = configurationBuilder.build()
213
218
 
214
219
  if (arguments?.getBoolean("customFlow") == true) {
@@ -490,6 +495,14 @@ fun mapToCollectionMode(str: String?): PaymentSheet.BillingDetailsCollectionConf
490
495
  }
491
496
  }
492
497
 
498
+ fun mapToPaymentMethodLayout(str: String?): PaymentSheet.PaymentMethodLayout {
499
+ return when (str) {
500
+ "Horizontal" -> PaymentSheet.PaymentMethodLayout.Horizontal
501
+ "Vertical" -> PaymentSheet.PaymentMethodLayout.Vertical
502
+ else -> PaymentSheet.PaymentMethodLayout.Automatic
503
+ }
504
+ }
505
+
493
506
  fun mapToAddressCollectionMode(str: String?): PaymentSheet.BillingDetailsCollectionConfiguration.AddressCollectionMode {
494
507
  return when (str) {
495
508
  "automatic" -> PaymentSheet.BillingDetailsCollectionConfiguration.AddressCollectionMode.Automatic
@@ -18,7 +18,6 @@ import com.stripe.android.googlepaylauncher.GooglePayLauncher
18
18
  import com.stripe.android.model.*
19
19
  import com.stripe.android.payments.bankaccount.CollectBankAccountConfiguration
20
20
  import com.stripe.android.paymentsheet.PaymentSheet
21
- import com.stripe.android.view.AddPaymentMethodActivityStarter
22
21
  import kotlinx.coroutines.CoroutineScope
23
22
  import kotlinx.coroutines.Dispatchers
24
23
  import kotlinx.coroutines.launch
@@ -77,14 +76,6 @@ class StripeSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
77
76
  }
78
77
  else -> {
79
78
  dispatchActivityResultsToFragments(requestCode, resultCode, data)
80
- try {
81
- val result = AddPaymentMethodActivityStarter.Result.fromIntent(data)
82
- if (data?.getParcelableExtra<Parcelable>("extra_activity_result") != null) {
83
- onFpxPaymentMethodResult(result)
84
- }
85
- } catch (e: java.lang.Exception) {
86
- Log.d("StripeReactNative", e.localizedMessage ?: e.toString())
87
- }
88
79
  }
89
80
  }
90
81
  }
@@ -219,48 +210,6 @@ class StripeSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
219
210
  paymentSheetFragment?.paymentSheetIntentCreationCallback?.complete(params)
220
211
  }
221
212
 
222
- private fun payWithFpx() {
223
- getCurrentActivityOrResolveWithError(confirmPromise)?.let {
224
- AddPaymentMethodActivityStarter(it)
225
- .startForResult(AddPaymentMethodActivityStarter.Args.Builder()
226
- .setPaymentMethodType(PaymentMethod.Type.Fpx)
227
- .build()
228
- )
229
- }
230
- }
231
-
232
- private fun onFpxPaymentMethodResult(result: AddPaymentMethodActivityStarter.Result) {
233
- when (result) {
234
- is AddPaymentMethodActivityStarter.Result.Success -> {
235
- if (confirmPaymentClientSecret != null && confirmPromise != null) {
236
- paymentLauncherFragment = PaymentLauncherFragment.forPayment(
237
- context = reactApplicationContext,
238
- stripe,
239
- publishableKey,
240
- stripeAccountId,
241
- confirmPromise!!,
242
- confirmPaymentClientSecret!!,
243
- ConfirmPaymentIntentParams.createWithPaymentMethodId(
244
- result.paymentMethod.id!!,
245
- confirmPaymentClientSecret!!
246
- )
247
- )
248
- } else {
249
- Log.e("StripeReactNative", "FPX payment failed. Promise and/or client secret is not set.")
250
- confirmPromise?.resolve(createError(ConfirmPaymentErrorType.Failed.toString(), "FPX payment failed. Client secret is not set."))
251
- }
252
- }
253
- is AddPaymentMethodActivityStarter.Result.Failure -> {
254
- confirmPromise?.resolve(createError(ConfirmPaymentErrorType.Failed.toString(), result.exception))
255
- }
256
- is AddPaymentMethodActivityStarter.Result.Canceled -> {
257
- confirmPromise?.resolve(createError(ConfirmPaymentErrorType.Canceled.toString(), "The payment has been canceled"))
258
- }
259
- }
260
- this.confirmPaymentClientSecret = null
261
- this.confirmPromise = null
262
- }
263
-
264
213
  @ReactMethod
265
214
  fun createPaymentMethod(data: ReadableMap, options: ReadableMap, promise: Promise) {
266
215
  val paymentMethodType = getValOr(data, "paymentMethodType")?.let { mapToPaymentMethodType(it) } ?: run {
@@ -460,15 +409,6 @@ class StripeSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
460
409
  else
461
410
  null // Expect that payment method was attached on the server
462
411
 
463
- val testOfflineBank = getBooleanOrFalse(params, "testOfflineBank")
464
-
465
- if (paymentMethodType == PaymentMethod.Type.Fpx && !testOfflineBank) {
466
- confirmPaymentClientSecret = paymentIntentClientSecret
467
- confirmPromise = promise
468
- payWithFpx()
469
- return
470
- }
471
-
472
412
  // if (paymentMethodType == PaymentMethod.Type.WeChatPay) {
473
413
  // val appId = getValOr(params, "appId") ?: run {
474
414
  // promise.resolve(createError("Failed", "You must provide appId"))
@@ -194,21 +194,4 @@ class CardFieldView: UIView, STPPaymentCardTextFieldDelegate {
194
194
  required init?(coder: NSCoder) {
195
195
  fatalError("init(coder:) has not been implemented")
196
196
  }
197
-
198
- func paymentContext(_ paymentContext: STPPaymentContext, didFailToLoadWithError error: Error) {
199
- //
200
- }
201
-
202
- func paymentContextDidChange(_ paymentContext: STPPaymentContext) {
203
- //
204
- }
205
-
206
- func paymentContext(_ paymentContext: STPPaymentContext, didCreatePaymentResult paymentResult: STPPaymentResult, completion: @escaping STPPaymentStatusBlock) {
207
- //
208
- }
209
-
210
- func paymentContext(_ paymentContext: STPPaymentContext, didFinishWith status: STPPaymentStatus, error: Error?) {
211
- //
212
- }
213
-
214
197
  }
@@ -116,6 +116,15 @@ extension StripeSdk {
116
116
  if let paymentMethodOrder = params["paymentMethodOrder"] as? Array<String> {
117
117
  configuration.paymentMethodOrder = paymentMethodOrder
118
118
  }
119
+
120
+ switch params["paymentMethodLayout"] as? String? {
121
+ case "Horizontal":
122
+ configuration.paymentMethodLayout = .horizontal
123
+ case "Vertical":
124
+ configuration.paymentMethodLayout = .vertical
125
+ default:
126
+ configuration.paymentMethodLayout = .automatic
127
+ }
119
128
 
120
129
  return (nil, configuration)
121
130
  }
@@ -5,7 +5,7 @@ import StripeFinancialConnections
5
5
  import Foundation
6
6
 
7
7
  @objc(StripeSdk)
8
- class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdaptivePresentationControllerDelegate {
8
+ class StripeSdk: RCTEventEmitter, UIAdaptivePresentationControllerDelegate {
9
9
  public var cardFieldView: CardFieldView? = nil
10
10
  public var cardFormView: CardFormView? = nil
11
11
 
@@ -14,21 +14,21 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
14
14
  internal var paymentSheet: PaymentSheet?
15
15
  internal var paymentSheetFlowController: PaymentSheet.FlowController?
16
16
  var paymentSheetIntentCreationCallback: ((Result<String, Error>) -> Void)?
17
-
17
+
18
18
  var urlScheme: String? = nil
19
-
19
+
20
20
  var confirmPaymentResolver: RCTPromiseResolveBlock? = nil
21
-
21
+
22
22
  var confirmApplePayResolver: RCTPromiseResolveBlock? = nil
23
23
  var confirmApplePayPaymentClientSecret: String? = nil
24
24
  var confirmApplePaySetupClientSecret: String? = nil
25
25
  var confirmApplePayPaymentMethod: STPPaymentMethod? = nil
26
-
26
+
27
27
  var applePaymentAuthorizationController: PKPaymentAuthorizationViewController? = nil
28
28
  var createPlatformPayPaymentMethodResolver: RCTPromiseResolveBlock? = nil
29
29
  var platformPayUsesDeprecatedTokenFlow = false
30
30
  var applePaymentMethodFlowCanBeCanceled = false
31
-
31
+
32
32
  var confirmPaymentClientSecret: String? = nil
33
33
 
34
34
  var shippingMethodUpdateCompletion: ((PKPaymentRequestShippingMethodUpdate) -> Void)? = nil
@@ -48,7 +48,7 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
48
48
  var applePayShippingMethods: [PKShippingMethod] = []
49
49
  var applePayShippingAddressErrors: [Error]? = nil
50
50
  var applePayCouponCodeErrors: [Error]? = nil
51
-
51
+
52
52
  var customerSheetConfiguration = CustomerSheet.Configuration()
53
53
  var customerSheet: CustomerSheet? = nil
54
54
  var customerAdapter: StripeCustomerAdapter? = nil
@@ -59,7 +59,7 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
59
59
  var setSelectedPaymentOptionCallback: (() -> Void)? = nil
60
60
  var fetchSelectedPaymentOptionCallback: ((CustomerPaymentOption?) -> Void)? = nil
61
61
  var setupIntentClientSecretForCustomerAttachCallback: ((String) -> Void)? = nil
62
-
62
+
63
63
  var hasEventListeners = false
64
64
  override func startObserving() {
65
65
  hasEventListeners = true
@@ -67,7 +67,7 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
67
67
  override func stopObserving() {
68
68
  hasEventListeners = false
69
69
  }
70
-
70
+
71
71
  override func supportedEvents() -> [String]! {
72
72
  return ["onOrderTrackingCallback", "onConfirmHandlerCallback", "onCustomerAdapterFetchPaymentMethodsCallback", "onCustomerAdapterAttachPaymentMethodCallback",
73
73
  "onCustomerAdapterDetachPaymentMethodCallback", "onCustomerAdapterSetSelectedPaymentOptionCallback", "onCustomerAdapterFetchSelectedPaymentOptionCallback",
@@ -124,10 +124,10 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
124
124
  resolve(error)
125
125
  return
126
126
  }
127
-
127
+
128
128
  preparePaymentSheetInstance(params: params, configuration: configuration, resolve: resolve)
129
129
  }
130
-
130
+
131
131
  @objc(intentCreationCallback:resolver:rejecter:)
132
132
  func intentCreationCallback(result: NSDictionary, resolver resolve: @escaping RCTPromiseResolveBlock,
133
133
  rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
@@ -174,7 +174,7 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
174
174
  }
175
175
  }
176
176
  }
177
-
177
+
178
178
  @objc(resetPaymentSheetCustomer:rejecter:)
179
179
  func resetPaymentSheetCustomer(resolver resolve: @escaping RCTPromiseResolveBlock,
180
180
  rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
@@ -187,7 +187,7 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
187
187
  resolver resolve: @escaping RCTPromiseResolveBlock,
188
188
  rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
189
189
  var paymentSheetViewController: UIViewController?
190
-
190
+
191
191
  if let timeout = options["timeout"] as? Double {
192
192
  DispatchQueue.main.asyncAfter(deadline: .now() + timeout/1000) {
193
193
  if let paymentSheetViewController = paymentSheetViewController {
@@ -278,7 +278,7 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
278
278
  err = Errors.createError(ErrorType.Failed, error as NSError?)
279
279
  }
280
280
  }
281
-
281
+
282
282
  parameters.mandateData = factory.createMandateData()
283
283
 
284
284
  return parameters
@@ -330,28 +330,28 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
330
330
  }
331
331
  return false
332
332
  }()
333
-
333
+
334
334
  if (shippingMethodUpdateCompletion == nil && shippingContactUpdateCompletion == nil && couponUpdateHandlerIsNil) {
335
335
  resolve(Errors.createError(ErrorType.Failed, "You can use this method only after either onShippingContactSelected, onShippingMethodSelected, or onCouponCodeEntered callbacks are triggered"))
336
336
  return
337
337
  }
338
-
338
+
339
339
  do {
340
340
  applePaySummaryItems = try ApplePayUtils.buildPaymentSummaryItems(items: summaryItems as? [[String : Any]])
341
341
  } catch {
342
342
  resolve(Errors.createError(ErrorType.Failed, error.localizedDescription))
343
343
  return
344
344
  }
345
-
345
+
346
346
  applePayShippingMethods = ApplePayUtils.buildShippingMethods(items: shippingMethods as? [[String : Any]])
347
-
347
+
348
348
  do {
349
349
  (applePayShippingAddressErrors, applePayCouponCodeErrors) = try ApplePayUtils.buildApplePayErrors(errorItems: errors)
350
350
  } catch {
351
351
  resolve(Errors.createError(ErrorType.Failed, error.localizedDescription))
352
352
  return
353
353
  }
354
-
354
+
355
355
 
356
356
  shippingMethodUpdateCompletion?(PKPaymentRequestShippingMethodUpdate.init(paymentSummaryItems: applePaySummaryItems))
357
357
  shippingContactUpdateCompletion?(PKPaymentRequestShippingContactUpdate.init(errors: applePayShippingAddressErrors, paymentSummaryItems: applePaySummaryItems, shippingMethods: applePayShippingMethods))
@@ -386,14 +386,14 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
386
386
  }
387
387
  }
388
388
  }
389
-
389
+
390
390
  @objc(isPlatformPaySupported:resolver:rejecter:)
391
391
  func isPlatformPaySupported(params: NSDictionary,
392
392
  resolver resolve: @escaping RCTPromiseResolveBlock,
393
393
  rejecter reject: @escaping RCTPromiseRejectBlock) {
394
394
  resolve(StripeAPI.deviceSupportsApplePay())
395
395
  }
396
-
396
+
397
397
  @objc(createPlatformPayPaymentMethod:usesDeprecatedTokenFlow:resolver:rejecter:)
398
398
  func createPlatformPayPaymentMethod(params: NSDictionary,
399
399
  usesDeprecatedTokenFlow: Bool,
@@ -408,7 +408,7 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
408
408
  resolve(error)
409
409
  return
410
410
  }
411
-
411
+
412
412
  self.applePaySummaryItems = paymentRequest.paymentSummaryItems
413
413
  self.applePayShippingMethods = paymentRequest.shippingMethods ?? []
414
414
  self.applePayShippingAddressErrors = nil
@@ -431,13 +431,13 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
431
431
  resolve(Errors.createError(ErrorType.Failed, "Invalid in-app payment request. Search the iOS logs for `NSUnderlyingError` to get more information."))
432
432
  }
433
433
  }
434
-
434
+
435
435
  @objc(dismissPlatformPay:rejecter:)
436
436
  func dismissPlatformPay(resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
437
437
  let didDismiss = maybeDismissApplePay()
438
438
  resolve(didDismiss)
439
439
  }
440
-
440
+
441
441
  @objc(confirmPlatformPay:params:isPaymentIntent:resolver:rejecter:)
442
442
  func confirmPlatformPay(
443
443
  clientSecret: String?,
@@ -475,7 +475,7 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
475
475
  resolve(Errors.createError(ErrorType.Failed, "Payment not completed"))
476
476
  }
477
477
  }
478
-
478
+
479
479
  func configure3dSecure(_ params: NSDictionary) {
480
480
  let threeDSCustomizationSettings = STPPaymentHandler.shared().threeDSCustomizationSettings
481
481
  let uiCustomization = Mappers.mapUICustomization(params)
@@ -695,7 +695,7 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
695
695
  }
696
696
  }
697
697
  }
698
-
698
+
699
699
  @objc(collectBankAccount:clientSecret:params:resolver:rejecter:)
700
700
  func collectBankAccount(
701
701
  isPaymentIntent: Bool,
@@ -806,14 +806,6 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
806
806
  return
807
807
  }
808
808
 
809
- if (paymentMethodType == .FPX) {
810
- let testOfflineBank = paymentMethodData?["testOfflineBank"] as? Bool
811
- if (testOfflineBank == false || testOfflineBank == nil) {
812
- payWithFPX(paymentIntentClientSecret)
813
- return
814
- }
815
- }
816
-
817
809
  let (error, paymentIntentParams) = createPaymentIntentParams(paymentIntentClientSecret: paymentIntentClientSecret, paymentMethodType: paymentMethodType, paymentMethodData: paymentMethodData, options: options)
818
810
 
819
811
  if (error != nil) {
@@ -864,14 +856,14 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
864
856
  err = Errors.createError(ErrorType.Failed, error as NSError?)
865
857
  }
866
858
  }
867
-
859
+
868
860
  do {
869
861
  parameters.paymentMethodOptions = try factory.createOptions(paymentMethodType: paymentMethodType)
870
862
  parameters.mandateData = factory.createMandateData()
871
863
  } catch {
872
864
  err = Errors.createError(ErrorType.Failed, error as NSError?)
873
865
  }
874
-
866
+
875
867
  return parameters
876
868
  }
877
869
  }()
@@ -1071,7 +1063,7 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
1071
1063
  }
1072
1064
  FinancialConnections.present(withClientSecret: clientSecret, returnURL: returnURL, resolve: resolve)
1073
1065
  }
1074
-
1066
+
1075
1067
  @objc(configureOrderTracking:orderIdentifier:webServiceUrl:authenticationToken:resolver:rejecter:)
1076
1068
  func configureOrderTracking(
1077
1069
  orderTypeIdentifier: String,
@@ -1102,35 +1094,6 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
1102
1094
  confirmPaymentResolver?(Errors.createError(ErrorType.Canceled, "FPX Payment has been canceled"))
1103
1095
  }
1104
1096
 
1105
- func payWithFPX(_ paymentIntentClientSecret: String) {
1106
- let vc = STPBankSelectionViewController.init(bankMethod: .FPX)
1107
-
1108
- vc.delegate = self
1109
-
1110
- DispatchQueue.main.async {
1111
- vc.presentationController?.delegate = self
1112
-
1113
- let share = UIApplication.shared.delegate
1114
- share?.window??.rootViewController?.present(vc, animated: true)
1115
- }
1116
- }
1117
-
1118
- func bankSelectionViewController(_ bankViewController: STPBankSelectionViewController, didCreatePaymentMethodParams paymentMethodParams: STPPaymentMethodParams) {
1119
- guard let clientSecret = confirmPaymentClientSecret else {
1120
- confirmPaymentResolver?(Errors.createError(ErrorType.Failed, "Missing paymentIntentClientSecret"))
1121
- return
1122
- }
1123
- let paymentIntentParams = STPPaymentIntentParams(clientSecret: clientSecret)
1124
- paymentIntentParams.paymentMethodParams = paymentMethodParams
1125
-
1126
- if let urlScheme = urlScheme {
1127
- paymentIntentParams.returnURL = Mappers.mapToReturnURL(urlScheme: urlScheme)
1128
- }
1129
- let paymentHandler = STPPaymentHandler.shared()
1130
- bankViewController.dismiss(animated: true)
1131
- paymentHandler.confirmPayment(paymentIntentParams, with: self, completion: onCompleteConfirmPayment)
1132
- }
1133
-
1134
1097
  func onCompleteConfirmPayment(status: STPPaymentHandlerActionStatus, paymentIntent: STPPaymentIntent?, error: NSError?) {
1135
1098
  self.confirmPaymentClientSecret = nil
1136
1099
  switch (status) {
@@ -1,2 +1,2 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.AddToWalletButton=AddToWalletButton;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _jsxFileName="/Users/charliecruzan/stripe/stripe-react-native/src/components/AddToWalletButton.tsx";var _excluded=["onComplete"];var AddToWalletButtonNative=(0,_reactNative.requireNativeComponent)('AddToWalletButton');function AddToWalletButton(_ref){var onComplete=_ref.onComplete,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);return _react.default.createElement(AddToWalletButtonNative,(0,_extends2.default)({},props,{onCompleteAction:function onCompleteAction(value){return onComplete(value.nativeEvent);},__self:this,__source:{fileName:_jsxFileName,lineNumber:84,columnNumber:5}}));}
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.AddToWalletButton=AddToWalletButton;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _jsxFileName="/Users/davidestes/stripe/stripe-react-native/src/components/AddToWalletButton.tsx";var _excluded=["onComplete"];var AddToWalletButtonNative=(0,_reactNative.requireNativeComponent)('AddToWalletButton');function AddToWalletButton(_ref){var onComplete=_ref.onComplete,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);return _react.default.createElement(AddToWalletButtonNative,(0,_extends2.default)({},props,{onCompleteAction:function onCompleteAction(value){return onComplete(value.nativeEvent);},__self:this,__source:{fileName:_jsxFileName,lineNumber:84,columnNumber:5}}));}
2
2
  //# sourceMappingURL=AddToWalletButton.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["AddToWalletButtonNative","requireNativeComponent","AddToWalletButton","onComplete","props","value","nativeEvent"],"sources":["AddToWalletButton.tsx"],"sourcesContent":["import React from 'react';\nimport {\n AccessibilityProps,\n StyleProp,\n ViewStyle,\n requireNativeComponent,\n NativeSyntheticEvent,\n ImageSourcePropType,\n} from 'react-native';\nimport type {\n Token,\n CardActionError,\n StripeError,\n GooglePayCardToken,\n} from '../types';\n\nconst AddToWalletButtonNative =\n requireNativeComponent<any>('AddToWalletButton');\n\n/**\n * Add to wallet button component props\n */\nexport interface Props extends AccessibilityProps {\n style?: StyleProp<ViewStyle>;\n /** Sets the Apple Wallet/Google Pay button style. If the button is placed over a dark background, set this to 'onDarkBackground', otherwise set to 'onLightBackground'. */\n iOSButtonStyle?: 'onDarkBackground' | 'onLightBackground';\n /** The image asset to use as the Google Pay button. Downloadable from https://developers.google.com/static/pay/issuers/apis/push-provisioning/android/downloads/flutter/2022_googlepay_flutter_buttons.zip */\n androidAssetSource: ImageSourcePropType;\n testID?: string;\n /** iOS only. Set this to `true` until shipping through TestFlight || App Store. If false, you must be using live cards, and have the proper iOS entitlement set up. See https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native#requesting-access-for-ios */\n testEnv?: boolean;\n /** Details of the Issued Card you'd like added to the device's wallet */\n cardDetails: {\n /** The `primary_account_identifier` value from the issued card. */\n primaryAccountIdentifier: string | null;\n /** The card holder name (used only on iOS) */\n name: string;\n /** A user-facing description of the card. Required on Android.*/\n description: string;\n /** Last 4 digits of the card, only used on iOS */\n lastFour?: string;\n /** Optional, only used on iOS */\n brand?: Token.CardBrand;\n };\n // Optional, only for Android and only for cards that are in the \"yellow path\" (as defined by Google- https://developers.google.com/pay/issuers/apis/push-provisioning/android/wallet-operations#resolving_yellow_path). Obtain this value via the `isCardInWallet` method.\n token?: GooglePayCardToken | null;\n /** Used by stripe to securely obtain card info of the card being provisioned. */\n ephemeralKey: object;\n /** Called when the flow completes. If the `error` field is `null`, then the card was successfully added to the user's native wallet. */\n onComplete(result: { error: StripeError<CardActionError> | null }): void;\n}\n\n/**\n * Add to wallet button\n *\n * @example\n * ```ts\n * <AddToWalletButton\n * testEnv={true}\n * style={styles.myButtonStyle}\n * iOSButtonStyle=\"onLightBackground\"\n * cardDetails={{\n * primaryAccountIdentifier: \"V-123\",\n * name: \"David Wallace\",\n * lastFour: \"4242\",\n * }}\n * ephemeralKey={myEphemeralKey} // This object is retrieved from your server. See https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native#update-your-backend\n * onComplete={(error) => {\n * Alert.alert(\n * error ? error.code : 'Success',\n * error\n * ? error.message\n * : 'Card was successfully added to the wallet.'\n * );\n * }}\n * />\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport function AddToWalletButton({ onComplete, ...props }: Props) {\n return (\n <AddToWalletButtonNative\n {...props}\n onCompleteAction={(\n value: NativeSyntheticEvent<{\n error: StripeError<CardActionError> | null;\n }>\n ) => onComplete(value.nativeEvent)}\n />\n );\n}\n"],"mappings":"wXAAA,oDACA,yCAOsB,qIAQtB,GAAMA,wBAAuB,CAC3B,GAAAC,mCAAsB,EAAM,mBAAmB,CAAC,CAgE3C,QAASC,kBAAiB,MAAkC,IAA/BC,WAAU,MAAVA,UAAU,CAAKC,KAAK,uDACtD,MACE,8BAAC,uBAAuB,0BAClBA,KAAK,EACT,gBAAgB,CAAE,0BAChBC,KAEE,QACCF,WAAU,CAACE,KAAK,CAACC,WAAW,CAAC,EAAC,6EACnC,CAEN"}
1
+ {"version":3,"names":["AddToWalletButtonNative","requireNativeComponent","AddToWalletButton","onComplete","props","value","nativeEvent"],"sources":["AddToWalletButton.tsx"],"sourcesContent":["import React from 'react';\nimport {\n AccessibilityProps,\n StyleProp,\n ViewStyle,\n requireNativeComponent,\n NativeSyntheticEvent,\n ImageSourcePropType,\n} from 'react-native';\nimport type {\n Token,\n CardActionError,\n StripeError,\n GooglePayCardToken,\n} from '../types';\n\nconst AddToWalletButtonNative =\n requireNativeComponent<any>('AddToWalletButton');\n\n/**\n * Add to wallet button component props\n */\nexport interface Props extends AccessibilityProps {\n style?: StyleProp<ViewStyle>;\n /** Sets the Apple Wallet/Google Pay button style. If the button is placed over a dark background, set this to 'onDarkBackground', otherwise set to 'onLightBackground'. */\n iOSButtonStyle?: 'onDarkBackground' | 'onLightBackground';\n /** The image asset to use as the Google Pay button. Downloadable from https://developers.google.com/static/pay/issuers/apis/push-provisioning/android/downloads/flutter/2022_googlepay_flutter_buttons.zip */\n androidAssetSource: ImageSourcePropType;\n testID?: string;\n /** iOS only. Set this to `true` until shipping through TestFlight || App Store. If false, you must be using live cards, and have the proper iOS entitlement set up. See https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native#requesting-access-for-ios */\n testEnv?: boolean;\n /** Details of the Issued Card you'd like added to the device's wallet */\n cardDetails: {\n /** The `primary_account_identifier` value from the issued card. */\n primaryAccountIdentifier: string | null;\n /** The card holder name (used only on iOS) */\n name: string;\n /** A user-facing description of the card. Required on Android.*/\n description: string;\n /** Last 4 digits of the card, only used on iOS */\n lastFour?: string;\n /** Optional, only used on iOS */\n brand?: Token.CardBrand;\n };\n // Optional, only for Android and only for cards that are in the \"yellow path\" (as defined by Google- https://developers.google.com/pay/issuers/apis/push-provisioning/android/wallet-operations#resolving_yellow_path). Obtain this value via the `isCardInWallet` method.\n token?: GooglePayCardToken | null;\n /** Used by stripe to securely obtain card info of the card being provisioned. */\n ephemeralKey: object;\n /** Called when the flow completes. If the `error` field is `null`, then the card was successfully added to the user's native wallet. */\n onComplete(result: { error: StripeError<CardActionError> | null }): void;\n}\n\n/**\n * Add to wallet button\n *\n * @example\n * ```ts\n * <AddToWalletButton\n * testEnv={true}\n * style={styles.myButtonStyle}\n * iOSButtonStyle=\"onLightBackground\"\n * cardDetails={{\n * primaryAccountIdentifier: \"V-123\",\n * name: \"David Wallace\",\n * lastFour: \"4242\",\n * }}\n * ephemeralKey={myEphemeralKey} // This object is retrieved from your server. See https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native#update-your-backend\n * onComplete={(error) => {\n * Alert.alert(\n * error ? error.code : 'Success',\n * error\n * ? error.message\n * : 'Card was successfully added to the wallet.'\n * );\n * }}\n * />\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport function AddToWalletButton({ onComplete, ...props }: Props) {\n return (\n <AddToWalletButtonNative\n {...props}\n onCompleteAction={(\n value: NativeSyntheticEvent<{\n error: StripeError<CardActionError> | null;\n }>\n ) => onComplete(value.nativeEvent)}\n />\n );\n}\n"],"mappings":"wXAAA,oDACA,yCAOsB,kIAQtB,GAAMA,wBAAuB,CAC3B,GAAAC,mCAAsB,EAAM,mBAAmB,CAAC,CAgE3C,QAASC,kBAAiB,MAAkC,IAA/BC,WAAU,MAAVA,UAAU,CAAKC,KAAK,uDACtD,MACE,8BAAC,uBAAuB,0BAClBA,KAAK,EACT,gBAAgB,CAAE,0BAChBC,KAEE,QACCF,WAAU,CAACE,KAAK,CAACC,WAAW,CAAC,EAAC,6EACnC,CAEN"}
@@ -1,2 +1,2 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.AddressSheet=AddressSheet;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _jsxFileName="/Users/charliecruzan/stripe/stripe-react-native/src/components/AddressSheet.tsx";var _excluded=["onSubmit","onError"];var AddressSheetNative=(0,_reactNative.requireNativeComponent)('AddressSheetView');function AddressSheet(_ref){var onSubmit=_ref.onSubmit,onError=_ref.onError,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);return _react.default.createElement(AddressSheetNative,(0,_extends2.default)({},props,{onSubmitAction:function onSubmitAction(value){return onSubmit(value.nativeEvent);},onErrorAction:function onErrorAction(value){return onError(value.nativeEvent.error);},__self:this,__source:{fileName:_jsxFileName,lineNumber:76,columnNumber:5}}));}
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.AddressSheet=AddressSheet;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _jsxFileName="/Users/davidestes/stripe/stripe-react-native/src/components/AddressSheet.tsx";var _excluded=["onSubmit","onError"];var AddressSheetNative=(0,_reactNative.requireNativeComponent)('AddressSheetView');function AddressSheet(_ref){var onSubmit=_ref.onSubmit,onError=_ref.onError,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);return _react.default.createElement(AddressSheetNative,(0,_extends2.default)({},props,{onSubmitAction:function onSubmitAction(value){return onSubmit(value.nativeEvent);},onErrorAction:function onErrorAction(value){return onError(value.nativeEvent.error);},__self:this,__source:{fileName:_jsxFileName,lineNumber:76,columnNumber:5}}));}
2
2
  //# sourceMappingURL=AddressSheet.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["AddressSheetNative","requireNativeComponent","AddressSheet","onSubmit","onError","props","value","nativeEvent","error"],"sources":["AddressSheet.tsx"],"sourcesContent":["import React from 'react';\nimport {\n AccessibilityProps,\n requireNativeComponent,\n NativeSyntheticEvent,\n} from 'react-native';\nimport type {\n PaymentSheet,\n AddressDetails,\n StripeError,\n AddressSheetError,\n} from '../types';\n\nconst AddressSheetNative = requireNativeComponent<any>('AddressSheetView');\n\n/**\n * Props\n */\nexport interface Props extends AccessibilityProps {\n /** Whether the sheet is visible. Defaults to false. */\n visible: boolean;\n /** Controls how the modal is presented (after animation). iOS only. Defaults to `popover`. See https://developer.apple.com/documentation/uikit/uimodalpresentationstyle for more info. */\n presentationStyle?:\n | 'fullscreen'\n | 'popover'\n | 'pageSheet'\n | 'formSheet'\n | 'automatic'\n | 'overFullScreen';\n /** Controls how the modal animates. iOS only. */\n animationStyle?: 'flip' | 'curl' | 'slide' | 'dissolve';\n /** Configuration for the look and feel of the UI. */\n appearance?: PaymentSheet.AppearanceParams;\n /** The values to prepopulate the sheet's fields with. */\n defaultValues?: AddressDetails;\n /** Configuration for additional fields besides the physical address */\n additionalFields?: {\n /** Determines whether the phone number is hidden, required, or optional. Defaults to hidden. */\n phoneNumber?: 'hidden' | 'optional' | 'required';\n /** The label of a checkbox displayed below other fields. If null or undefined, the checkbox is not displayed. */\n checkboxLabel?: string;\n };\n /** A list of two-letter country codes representing countries the customers can select. If the list is empty (the default), we display all countries. */\n allowedCountries?: Array<string>;\n /** A list of two-letter country codes representing countries that support address autocomplete. Defaults to a list of countries that Stripe has audited to ensure a good autocomplete experience. */\n autocompleteCountries?: Array<string>;\n /** The title of the primary button displayed at the bottom of the screen. Defaults to \"Save Address\". */\n primaryButtonTitle?: string;\n /** Title displayed at the top of the sheet. Defaults to \"Address\". */\n sheetTitle?: string;\n /** Android only. Google Places api key used to provide autocomplete suggestions. When null, autocomplete is disabled on Android. */\n googlePlacesApiKey?: string;\n /** Called when the user submits their information */\n onSubmit: (result: CollectAddressResult) => void;\n /** Called when the user taps the button to close the sheet before submitting their information, or when an error occurs. */\n onError: (error: StripeError<AddressSheetError>) => void;\n}\n\nexport type CollectAddressResult = Required<AddressDetails>;\n\n/**\n *\n *\n * @example\n * ```ts\n * <AddressSheet\n *\n * />\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport function AddressSheet({ onSubmit, onError, ...props }: Props) {\n return (\n <AddressSheetNative\n {...props}\n onSubmitAction={(value: NativeSyntheticEvent<CollectAddressResult>) =>\n onSubmit(value.nativeEvent)\n }\n onErrorAction={(\n value: NativeSyntheticEvent<{\n error: StripeError<AddressSheetError>;\n }>\n ) => onError(value.nativeEvent.error)}\n />\n );\n}\n"],"mappings":"8WAAA,oDACA,yCAIsB,wIAQtB,GAAMA,mBAAkB,CAAG,GAAAC,mCAAsB,EAAM,kBAAkB,CAAC,CA4DnE,QAASC,aAAY,MAAyC,IAAtCC,SAAQ,MAARA,QAAQ,CAAEC,OAAO,MAAPA,OAAO,CAAKC,KAAK,uDACxD,MACE,8BAAC,kBAAkB,0BACbA,KAAK,EACT,cAAc,CAAE,wBAACC,KAAiD,QAChEH,SAAQ,CAACG,KAAK,CAACC,WAAW,CAAC,EAC5B,CACD,aAAa,CAAE,uBACbD,KAEE,QACCF,QAAO,CAACE,KAAK,CAACC,WAAW,CAACC,KAAK,CAAC,EAAC,6EACtC,CAEN"}
1
+ {"version":3,"names":["AddressSheetNative","requireNativeComponent","AddressSheet","onSubmit","onError","props","value","nativeEvent","error"],"sources":["AddressSheet.tsx"],"sourcesContent":["import React from 'react';\nimport {\n AccessibilityProps,\n requireNativeComponent,\n NativeSyntheticEvent,\n} from 'react-native';\nimport type {\n PaymentSheet,\n AddressDetails,\n StripeError,\n AddressSheetError,\n} from '../types';\n\nconst AddressSheetNative = requireNativeComponent<any>('AddressSheetView');\n\n/**\n * Props\n */\nexport interface Props extends AccessibilityProps {\n /** Whether the sheet is visible. Defaults to false. */\n visible: boolean;\n /** Controls how the modal is presented (after animation). iOS only. Defaults to `popover`. See https://developer.apple.com/documentation/uikit/uimodalpresentationstyle for more info. */\n presentationStyle?:\n | 'fullscreen'\n | 'popover'\n | 'pageSheet'\n | 'formSheet'\n | 'automatic'\n | 'overFullScreen';\n /** Controls how the modal animates. iOS only. */\n animationStyle?: 'flip' | 'curl' | 'slide' | 'dissolve';\n /** Configuration for the look and feel of the UI. */\n appearance?: PaymentSheet.AppearanceParams;\n /** The values to prepopulate the sheet's fields with. */\n defaultValues?: AddressDetails;\n /** Configuration for additional fields besides the physical address */\n additionalFields?: {\n /** Determines whether the phone number is hidden, required, or optional. Defaults to hidden. */\n phoneNumber?: 'hidden' | 'optional' | 'required';\n /** The label of a checkbox displayed below other fields. If null or undefined, the checkbox is not displayed. */\n checkboxLabel?: string;\n };\n /** A list of two-letter country codes representing countries the customers can select. If the list is empty (the default), we display all countries. */\n allowedCountries?: Array<string>;\n /** A list of two-letter country codes representing countries that support address autocomplete. Defaults to a list of countries that Stripe has audited to ensure a good autocomplete experience. */\n autocompleteCountries?: Array<string>;\n /** The title of the primary button displayed at the bottom of the screen. Defaults to \"Save Address\". */\n primaryButtonTitle?: string;\n /** Title displayed at the top of the sheet. Defaults to \"Address\". */\n sheetTitle?: string;\n /** Android only. Google Places api key used to provide autocomplete suggestions. When null, autocomplete is disabled on Android. */\n googlePlacesApiKey?: string;\n /** Called when the user submits their information */\n onSubmit: (result: CollectAddressResult) => void;\n /** Called when the user taps the button to close the sheet before submitting their information, or when an error occurs. */\n onError: (error: StripeError<AddressSheetError>) => void;\n}\n\nexport type CollectAddressResult = Required<AddressDetails>;\n\n/**\n *\n *\n * @example\n * ```ts\n * <AddressSheet\n *\n * />\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport function AddressSheet({ onSubmit, onError, ...props }: Props) {\n return (\n <AddressSheetNative\n {...props}\n onSubmitAction={(value: NativeSyntheticEvent<CollectAddressResult>) =>\n onSubmit(value.nativeEvent)\n }\n onErrorAction={(\n value: NativeSyntheticEvent<{\n error: StripeError<AddressSheetError>;\n }>\n ) => onError(value.nativeEvent.error)}\n />\n );\n}\n"],"mappings":"8WAAA,oDACA,yCAIsB,qIAQtB,GAAMA,mBAAkB,CAAG,GAAAC,mCAAsB,EAAM,kBAAkB,CAAC,CA4DnE,QAASC,aAAY,MAAyC,IAAtCC,SAAQ,MAARA,QAAQ,CAAEC,OAAO,MAAPA,OAAO,CAAKC,KAAK,uDACxD,MACE,8BAAC,kBAAkB,0BACbA,KAAK,EACT,cAAc,CAAE,wBAACC,KAAiD,QAChEH,SAAQ,CAACG,KAAK,CAACC,WAAW,CAAC,EAC5B,CACD,aAAa,CAAE,uBACbD,KAEE,QACCF,QAAO,CAACE,KAAK,CAACC,WAAW,CAACC,KAAK,CAAC,EAAC,6EACtC,CAEN"}
@@ -1,2 +1,2 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.AuBECSDebitForm=AuBECSDebitForm;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _jsxFileName="/Users/charliecruzan/stripe/stripe-react-native/src/components/AuBECSDebitForm.tsx";var _excluded=["onComplete","companyName","formStyle"];var AuBECSDebitFormNative=(0,_reactNative.requireNativeComponent)('AuBECSDebitForm');function AuBECSDebitForm(_ref){var onComplete=_ref.onComplete,companyName=_ref.companyName,formStyle=_ref.formStyle,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);return _react.default.createElement(AuBECSDebitFormNative,(0,_extends2.default)({onCompleteAction:function onCompleteAction(value){return onComplete(value.nativeEvent);},companyName:companyName,formStyle:Object.assign({},formStyle)},props,{__self:this,__source:{fileName:_jsxFileName,lineNumber:48,columnNumber:5}}));}
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.AuBECSDebitForm=AuBECSDebitForm;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _jsxFileName="/Users/davidestes/stripe/stripe-react-native/src/components/AuBECSDebitForm.tsx";var _excluded=["onComplete","companyName","formStyle"];var AuBECSDebitFormNative=(0,_reactNative.requireNativeComponent)('AuBECSDebitForm');function AuBECSDebitForm(_ref){var onComplete=_ref.onComplete,companyName=_ref.companyName,formStyle=_ref.formStyle,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);return _react.default.createElement(AuBECSDebitFormNative,(0,_extends2.default)({onCompleteAction:function onCompleteAction(value){return onComplete(value.nativeEvent);},companyName:companyName,formStyle:Object.assign({},formStyle)},props,{__self:this,__source:{fileName:_jsxFileName,lineNumber:48,columnNumber:5}}));}
2
2
  //# sourceMappingURL=AuBECSDebitForm.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["AuBECSDebitFormNative","requireNativeComponent","AuBECSDebitForm","onComplete","companyName","formStyle","props","value","nativeEvent"],"sources":["AuBECSDebitForm.tsx"],"sourcesContent":["import React from 'react';\nimport {\n AccessibilityProps,\n requireNativeComponent,\n StyleProp,\n ViewStyle,\n} from 'react-native';\nimport type { AuBECSDebitFormComponent } from '../types';\n\nconst AuBECSDebitFormNative =\n requireNativeComponent<AuBECSDebitFormComponent.NativeProps>(\n 'AuBECSDebitForm'\n );\n\n/**\n * BECS Debit Form Component Props\n */\nexport interface Props extends AccessibilityProps {\n companyName: string;\n onComplete(value: AuBECSDebitFormComponent.FormDetails): void;\n formStyle?: AuBECSDebitFormComponent.Styles;\n style?: StyleProp<ViewStyle>;\n testID?: string;\n}\n\n/**\n * BECS Debit form component\n *\n * @example\n * ```ts\n * <AuBECSDebitForm\n * companyName=\"Example Company Inc.\"\n * onComplete={value => onComplete(value)}\n * style={{ width: '100%', height: 500 }}\n * />\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport function AuBECSDebitForm({\n onComplete,\n companyName,\n formStyle,\n ...props\n}: Props) {\n return (\n <AuBECSDebitFormNative\n onCompleteAction={(value) => onComplete(value.nativeEvent)}\n companyName={companyName}\n formStyle={{ ...formStyle }}\n {...props}\n />\n );\n}\n"],"mappings":"oXAAA,oDACA,yCAKsB,6JAGtB,GAAMA,sBAAqB,CACzB,GAAAC,mCAAsB,EACpB,iBAAiB,CAClB,CA4BI,QAASC,gBAAe,MAKrB,IAJRC,WAAU,MAAVA,UAAU,CACVC,WAAW,MAAXA,WAAW,CACXC,SAAS,MAATA,SAAS,CACNC,KAAK,uDAER,MACE,8BAAC,qBAAqB,wBACpB,gBAAgB,CAAE,0BAACC,KAAK,QAAKJ,WAAU,CAACI,KAAK,CAACC,WAAW,CAAC,EAAC,CAC3D,WAAW,CAAEJ,WAAY,CACzB,SAAS,kBAAOC,SAAS,CAAG,EACxBC,KAAK,8EACT,CAEN"}
1
+ {"version":3,"names":["AuBECSDebitFormNative","requireNativeComponent","AuBECSDebitForm","onComplete","companyName","formStyle","props","value","nativeEvent"],"sources":["AuBECSDebitForm.tsx"],"sourcesContent":["import React from 'react';\nimport {\n AccessibilityProps,\n requireNativeComponent,\n StyleProp,\n ViewStyle,\n} from 'react-native';\nimport type { AuBECSDebitFormComponent } from '../types';\n\nconst AuBECSDebitFormNative =\n requireNativeComponent<AuBECSDebitFormComponent.NativeProps>(\n 'AuBECSDebitForm'\n );\n\n/**\n * BECS Debit Form Component Props\n */\nexport interface Props extends AccessibilityProps {\n companyName: string;\n onComplete(value: AuBECSDebitFormComponent.FormDetails): void;\n formStyle?: AuBECSDebitFormComponent.Styles;\n style?: StyleProp<ViewStyle>;\n testID?: string;\n}\n\n/**\n * BECS Debit form component\n *\n * @example\n * ```ts\n * <AuBECSDebitForm\n * companyName=\"Example Company Inc.\"\n * onComplete={value => onComplete(value)}\n * style={{ width: '100%', height: 500 }}\n * />\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport function AuBECSDebitForm({\n onComplete,\n companyName,\n formStyle,\n ...props\n}: Props) {\n return (\n <AuBECSDebitFormNative\n onCompleteAction={(value) => onComplete(value.nativeEvent)}\n companyName={companyName}\n formStyle={{ ...formStyle }}\n {...props}\n />\n );\n}\n"],"mappings":"oXAAA,oDACA,yCAKsB,0JAGtB,GAAMA,sBAAqB,CACzB,GAAAC,mCAAsB,EACpB,iBAAiB,CAClB,CA4BI,QAASC,gBAAe,MAKrB,IAJRC,WAAU,MAAVA,UAAU,CACVC,WAAW,MAAXA,WAAW,CACXC,SAAS,MAATA,SAAS,CACNC,KAAK,uDAER,MACE,8BAAC,qBAAqB,wBACpB,gBAAgB,CAAE,0BAACC,KAAK,QAAKJ,WAAU,CAACI,KAAK,CAACC,WAAW,CAAC,EAAC,CAC3D,WAAW,CAAEJ,WAAY,CACzB,SAAS,kBAAOC,SAAS,CAAG,EACxBC,KAAK,8EACT,CAEN"}
@@ -1,2 +1,2 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.CardField=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _helpers=require("../helpers");var _excluded=["onCardChange","onFocus","onBlur","cardStyle","placeholders","postalCodeEnabled","countryCode"];var _this=this,_jsxFileName="/Users/charliecruzan/stripe/stripe-react-native/src/components/CardField.tsx";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var CardFieldNative=(0,_reactNative.requireNativeComponent)('CardField');var CardField=(0,_react.forwardRef)(function(_ref,ref){var onCardChange=_ref.onCardChange,onFocus=_ref.onFocus,onBlur=_ref.onBlur,cardStyle=_ref.cardStyle,placeholders=_ref.placeholders,postalCodeEnabled=_ref.postalCodeEnabled,countryCode=_ref.countryCode,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);var inputRef=(0,_react.useRef)(null);var onCardChangeHandler=(0,_react.useCallback)(function(event){var card=event.nativeEvent;var data={last4:card.last4,expiryMonth:card.expiryMonth,expiryYear:card.expiryYear,complete:card.complete,brand:card.brand,validExpiryDate:card.validExpiryDate,validNumber:card.validNumber,validCVC:card.validCVC};if(card.hasOwnProperty('postalCode')){data.postalCode=card.postalCode||'';}if(card.hasOwnProperty('number')||card.hasOwnProperty('cvc')){data.number=card.number||'';data.cvc=card.cvc||'';if(__DEV__&&onCardChange&&card.complete){console.warn("[stripe-react-native] \u26A0\uFE0F WARNING: You've enabled `dangerouslyGetFullCardDetails`, meaning full card details are being returned. Only do this if you're certain that you fulfill the necessary PCI compliance requirements. Make sure that you're not mistakenly logging or storing full card details! See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance");}}onCardChange==null?void 0:onCardChange(data);},[onCardChange]);var onFocusHandler=(0,_react.useCallback)(function(event){var focusedField=event.nativeEvent.focusedField;if(focusedField){(0,_helpers.focusInput)(inputRef.current);onFocus==null?void 0:onFocus(focusedField);}else{onBlur==null?void 0:onBlur();}},[onFocus,onBlur]);var focus=function focus(){_reactNative.UIManager.dispatchViewManagerCommand((0,_reactNative.findNodeHandle)(inputRef.current),'focus',[]);};var blur=function blur(){_reactNative.UIManager.dispatchViewManagerCommand((0,_reactNative.findNodeHandle)(inputRef.current),'blur',[]);};var clear=function clear(){_reactNative.UIManager.dispatchViewManagerCommand((0,_reactNative.findNodeHandle)(inputRef.current),'clear',[]);};(0,_react.useImperativeHandle)(ref,function(){return{focus:focus,blur:blur,clear:clear};});(0,_react.useLayoutEffect)(function(){var inputRefValue=inputRef.current;if(inputRefValue!==null){(0,_helpers.registerInput)(inputRefValue);return function(){(0,_helpers.unregisterInput)(inputRefValue);if((0,_helpers.currentlyFocusedInput)()===inputRefValue){inputRefValue.blur();}};}return function(){};},[inputRef]);return _react.default.createElement(CardFieldNative,(0,_extends2.default)({ref:inputRef,onCardChange:onCardChangeHandler,onFocusChange:onFocusHandler,postalCodeEnabled:postalCodeEnabled!=null?postalCodeEnabled:true,countryCode:countryCode!=null?countryCode:null,cardStyle:{backgroundColor:cardStyle==null?void 0:cardStyle.backgroundColor,borderColor:cardStyle==null?void 0:cardStyle.borderColor,borderWidth:cardStyle==null?void 0:cardStyle.borderWidth,borderRadius:cardStyle==null?void 0:cardStyle.borderRadius,cursorColor:cardStyle==null?void 0:cardStyle.cursorColor,fontSize:cardStyle==null?void 0:cardStyle.fontSize,placeholderColor:cardStyle==null?void 0:cardStyle.placeholderColor,textColor:cardStyle==null?void 0:cardStyle.textColor,textErrorColor:cardStyle==null?void 0:cardStyle.textErrorColor,fontFamily:cardStyle==null?void 0:cardStyle.fontFamily},placeholders:{number:placeholders==null?void 0:placeholders.number,expiration:placeholders==null?void 0:placeholders.expiration,cvc:placeholders==null?void 0:placeholders.cvc,postalCode:placeholders==null?void 0:placeholders.postalCode}},props,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:184,columnNumber:7}}));});exports.CardField=CardField;
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.CardField=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _helpers=require("../helpers");var _excluded=["onCardChange","onFocus","onBlur","cardStyle","placeholders","postalCodeEnabled","countryCode"];var _this=this,_jsxFileName="/Users/davidestes/stripe/stripe-react-native/src/components/CardField.tsx";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var CardFieldNative=(0,_reactNative.requireNativeComponent)('CardField');var CardField=(0,_react.forwardRef)(function(_ref,ref){var onCardChange=_ref.onCardChange,onFocus=_ref.onFocus,onBlur=_ref.onBlur,cardStyle=_ref.cardStyle,placeholders=_ref.placeholders,postalCodeEnabled=_ref.postalCodeEnabled,countryCode=_ref.countryCode,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);var inputRef=(0,_react.useRef)(null);var onCardChangeHandler=(0,_react.useCallback)(function(event){var card=event.nativeEvent;var data={last4:card.last4,expiryMonth:card.expiryMonth,expiryYear:card.expiryYear,complete:card.complete,brand:card.brand,validExpiryDate:card.validExpiryDate,validNumber:card.validNumber,validCVC:card.validCVC};if(card.hasOwnProperty('postalCode')){data.postalCode=card.postalCode||'';}if(card.hasOwnProperty('number')||card.hasOwnProperty('cvc')){data.number=card.number||'';data.cvc=card.cvc||'';if(__DEV__&&onCardChange&&card.complete){console.warn("[stripe-react-native] \u26A0\uFE0F WARNING: You've enabled `dangerouslyGetFullCardDetails`, meaning full card details are being returned. Only do this if you're certain that you fulfill the necessary PCI compliance requirements. Make sure that you're not mistakenly logging or storing full card details! See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance");}}onCardChange==null?void 0:onCardChange(data);},[onCardChange]);var onFocusHandler=(0,_react.useCallback)(function(event){var focusedField=event.nativeEvent.focusedField;if(focusedField){(0,_helpers.focusInput)(inputRef.current);onFocus==null?void 0:onFocus(focusedField);}else{onBlur==null?void 0:onBlur();}},[onFocus,onBlur]);var focus=function focus(){_reactNative.UIManager.dispatchViewManagerCommand((0,_reactNative.findNodeHandle)(inputRef.current),'focus',[]);};var blur=function blur(){_reactNative.UIManager.dispatchViewManagerCommand((0,_reactNative.findNodeHandle)(inputRef.current),'blur',[]);};var clear=function clear(){_reactNative.UIManager.dispatchViewManagerCommand((0,_reactNative.findNodeHandle)(inputRef.current),'clear',[]);};(0,_react.useImperativeHandle)(ref,function(){return{focus:focus,blur:blur,clear:clear};});(0,_react.useLayoutEffect)(function(){var inputRefValue=inputRef.current;if(inputRefValue!==null){(0,_helpers.registerInput)(inputRefValue);return function(){(0,_helpers.unregisterInput)(inputRefValue);if((0,_helpers.currentlyFocusedInput)()===inputRefValue){inputRefValue.blur();}};}return function(){};},[inputRef]);return _react.default.createElement(CardFieldNative,(0,_extends2.default)({ref:inputRef,onCardChange:onCardChangeHandler,onFocusChange:onFocusHandler,postalCodeEnabled:postalCodeEnabled!=null?postalCodeEnabled:true,countryCode:countryCode!=null?countryCode:null,cardStyle:{backgroundColor:cardStyle==null?void 0:cardStyle.backgroundColor,borderColor:cardStyle==null?void 0:cardStyle.borderColor,borderWidth:cardStyle==null?void 0:cardStyle.borderWidth,borderRadius:cardStyle==null?void 0:cardStyle.borderRadius,cursorColor:cardStyle==null?void 0:cardStyle.cursorColor,fontSize:cardStyle==null?void 0:cardStyle.fontSize,placeholderColor:cardStyle==null?void 0:cardStyle.placeholderColor,textColor:cardStyle==null?void 0:cardStyle.textColor,textErrorColor:cardStyle==null?void 0:cardStyle.textErrorColor,fontFamily:cardStyle==null?void 0:cardStyle.fontFamily},placeholders:{number:placeholders==null?void 0:placeholders.number,expiration:placeholders==null?void 0:placeholders.expiration,cvc:placeholders==null?void 0:placeholders.cvc,postalCode:placeholders==null?void 0:placeholders.postalCode}},props,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:184,columnNumber:7}}));});exports.CardField=CardField;
2
2
  //# sourceMappingURL=CardField.js.map