@stripe/stripe-react-native 0.54.1 → 0.55.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementView.kt +120 -57
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManager.kt +5 -0
- package/android/src/main/java/com/reactnativestripesdk/EventEmitterCompat.kt +4 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherFragment.kt +1 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +54 -8
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +18 -0
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +84 -1
- package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +4 -0
- package/ios/Errors.swift +3 -2
- package/ios/Mappers.swift +111 -18
- package/ios/OldArch/StripeSdkEventEmitterCompat.h +1 -0
- package/ios/OldArch/StripeSdkEventEmitterCompat.m +6 -0
- package/ios/PaymentSheetAppearance.swift +15 -0
- package/ios/StripeSdk.mm +7 -0
- package/ios/StripeSdkEmitter.swift +1 -0
- package/ios/StripeSdkImpl+Embedded.swift +26 -4
- package/ios/StripeSdkImpl+PaymentSheet.swift +37 -15
- package/ios/StripeSdkImpl.swift +18 -1
- package/lib/commonjs/components/AddToWalletButton.js +1 -1
- package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
- package/lib/commonjs/components/AddressSheet.js +1 -1
- package/lib/commonjs/components/AddressSheet.js.map +1 -1
- package/lib/commonjs/components/AuBECSDebitForm.js +1 -1
- package/lib/commonjs/components/AuBECSDebitForm.js.map +1 -1
- package/lib/commonjs/components/CardField.js +1 -1
- package/lib/commonjs/components/CardField.js.map +1 -1
- package/lib/commonjs/components/CardForm.js +1 -1
- package/lib/commonjs/components/CardForm.js.map +1 -1
- package/lib/commonjs/components/PlatformPayButton.js +1 -1
- package/lib/commonjs/components/PlatformPayButton.js.map +1 -1
- package/lib/commonjs/components/StripeContainer.js +1 -1
- package/lib/commonjs/components/StripeContainer.js.map +1 -1
- package/lib/commonjs/events.js.map +1 -1
- package/lib/commonjs/functions.js +1 -1
- package/lib/commonjs/functions.js.map +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/NativeStripeSdkModule.js.map +1 -1
- package/lib/commonjs/types/ConfirmationToken.js +2 -0
- package/lib/commonjs/types/ConfirmationToken.js.map +1 -0
- package/lib/commonjs/types/EmbeddedPaymentElement.js +1 -1
- package/lib/commonjs/types/EmbeddedPaymentElement.js.map +1 -1
- package/lib/commonjs/types/PaymentSheet.js +1 -1
- package/lib/commonjs/types/PaymentSheet.js.map +1 -1
- package/lib/commonjs/types/index.js +1 -1
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/module/components/AddToWalletButton.js +1 -1
- package/lib/module/components/AddToWalletButton.js.map +1 -1
- package/lib/module/components/AddressSheet.js +1 -1
- package/lib/module/components/AddressSheet.js.map +1 -1
- package/lib/module/components/AuBECSDebitForm.js +1 -1
- package/lib/module/components/AuBECSDebitForm.js.map +1 -1
- package/lib/module/components/CardField.js +1 -1
- package/lib/module/components/CardField.js.map +1 -1
- package/lib/module/components/CardForm.js +1 -1
- package/lib/module/components/CardForm.js.map +1 -1
- package/lib/module/components/PlatformPayButton.js +1 -1
- package/lib/module/components/PlatformPayButton.js.map +1 -1
- package/lib/module/components/StripeContainer.js +1 -1
- package/lib/module/components/StripeContainer.js.map +1 -1
- package/lib/module/events.js.map +1 -1
- package/lib/module/functions.js +1 -1
- package/lib/module/functions.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/NativeStripeSdkModule.js.map +1 -1
- package/lib/module/types/ConfirmationToken.js +2 -0
- package/lib/module/types/ConfirmationToken.js.map +1 -0
- package/lib/module/types/EmbeddedPaymentElement.js +1 -1
- package/lib/module/types/EmbeddedPaymentElement.js.map +1 -1
- package/lib/module/types/PaymentSheet.js +1 -1
- package/lib/module/types/PaymentSheet.js.map +1 -1
- package/lib/module/types/index.js +1 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/typescript/src/events.d.ts +4 -0
- package/lib/typescript/src/events.d.ts.map +1 -1
- package/lib/typescript/src/functions.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +1 -0
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -1
- package/lib/typescript/src/types/ConfirmationToken.d.ts +59 -0
- package/lib/typescript/src/types/ConfirmationToken.d.ts.map +1 -0
- package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts.map +1 -1
- package/lib/typescript/src/types/PaymentSheet.d.ts +52 -3
- package/lib/typescript/src/types/PaymentSheet.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +2 -1
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/events.ts +4 -0
- package/src/functions.ts +16 -0
- package/src/index.tsx +1 -0
- package/src/specs/NativeStripeSdkModule.ts +3 -0
- package/src/types/ConfirmationToken.ts +76 -0
- package/src/types/EmbeddedPaymentElement.tsx +21 -0
- package/src/types/PaymentSheet.ts +60 -11
- package/src/types/index.ts +2 -0
- package/stripe-react-native.podspec +1 -1
- package/android/.idea/AndroidProjectSystem.xml +0 -6
- package/android/.idea/caches/deviceStreaming.xml +0 -703
- package/android/.idea/compiler.xml +0 -6
- package/android/.idea/gradle.xml +0 -18
- package/android/.idea/migrations.xml +0 -10
- package/android/.idea/misc.xml +0 -10
- package/android/.idea/runConfigurations.xml +0 -17
- package/android/.idea/vcs.xml +0 -6
- package/android/local.properties +0 -8
package/ios/Mappers.swift
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import Stripe
|
|
2
2
|
import StripePaymentSheet
|
|
3
|
+
@_spi(ConfirmationTokensPublicPreview) import StripePayments
|
|
4
|
+
import Contacts
|
|
3
5
|
|
|
4
6
|
class Mappers {
|
|
5
7
|
class func createResult(_ key: String, _ value: NSDictionary?, additionalFields: [String: Any]? = nil) -> NSDictionary {
|
|
@@ -298,6 +300,7 @@ class Mappers {
|
|
|
298
300
|
case STPPaymentMethodType.affirm: return "Affirm"
|
|
299
301
|
case STPPaymentMethodType.cashApp: return "CashApp"
|
|
300
302
|
case STPPaymentMethodType.revolutPay: return "RevolutPay"
|
|
303
|
+
case STPPaymentMethodType.link: return "Link"
|
|
301
304
|
case STPPaymentMethodType.unknown: return "Unknown"
|
|
302
305
|
default: return "Unknown"
|
|
303
306
|
}
|
|
@@ -331,6 +334,7 @@ class Mappers {
|
|
|
331
334
|
case "Affirm": return STPPaymentMethodType.affirm
|
|
332
335
|
case "CashApp": return STPPaymentMethodType.cashApp
|
|
333
336
|
case "RevolutPay": return STPPaymentMethodType.revolutPay
|
|
337
|
+
case "Link": return STPPaymentMethodType.link
|
|
334
338
|
default: return STPPaymentMethodType.unknown
|
|
335
339
|
}
|
|
336
340
|
}
|
|
@@ -557,18 +561,31 @@ class Mappers {
|
|
|
557
561
|
}
|
|
558
562
|
|
|
559
563
|
class func mapFromBillingDetails(billingDetails: STPPaymentMethodBillingDetails?) -> NSDictionary {
|
|
564
|
+
let email: Any = billingDetails?.email ?? NSNull()
|
|
565
|
+
let phone: Any = billingDetails?.phone ?? NSNull()
|
|
566
|
+
let name: Any = billingDetails?.name ?? NSNull()
|
|
567
|
+
|
|
568
|
+
let addressCity: Any = billingDetails?.address?.city ?? NSNull()
|
|
569
|
+
let addressPostalCode: Any = billingDetails?.address?.postalCode ?? NSNull()
|
|
570
|
+
let addressCountry: Any = billingDetails?.address?.country ?? NSNull()
|
|
571
|
+
let addressLine1: Any = billingDetails?.address?.line1 ?? NSNull()
|
|
572
|
+
let addressLine2: Any = billingDetails?.address?.line2 ?? NSNull()
|
|
573
|
+
let addressState: Any = billingDetails?.address?.state ?? NSNull()
|
|
574
|
+
|
|
575
|
+
let address: NSDictionary = [
|
|
576
|
+
"city": addressCity,
|
|
577
|
+
"postalCode": addressPostalCode,
|
|
578
|
+
"country": addressCountry,
|
|
579
|
+
"line1": addressLine1,
|
|
580
|
+
"line2": addressLine2,
|
|
581
|
+
"state": addressState,
|
|
582
|
+
]
|
|
583
|
+
|
|
560
584
|
let billing: NSDictionary = [
|
|
561
|
-
"email":
|
|
562
|
-
"phone":
|
|
563
|
-
"name":
|
|
564
|
-
"address":
|
|
565
|
-
"city": billingDetails?.address?.city,
|
|
566
|
-
"postalCode": billingDetails?.address?.postalCode,
|
|
567
|
-
"country": billingDetails?.address?.country,
|
|
568
|
-
"line1": billingDetails?.address?.line1,
|
|
569
|
-
"line2": billingDetails?.address?.line2,
|
|
570
|
-
"state": billingDetails?.address?.state,
|
|
571
|
-
],
|
|
585
|
+
"email": email,
|
|
586
|
+
"phone": phone,
|
|
587
|
+
"name": name,
|
|
588
|
+
"address": address,
|
|
572
589
|
]
|
|
573
590
|
|
|
574
591
|
return billing
|
|
@@ -679,6 +696,89 @@ class Mappers {
|
|
|
679
696
|
return method
|
|
680
697
|
}
|
|
681
698
|
|
|
699
|
+
class func mapFromConfirmationToken(_ confirmationToken: STPConfirmationToken?) -> NSDictionary? {
|
|
700
|
+
guard let confirmationToken = confirmationToken else {
|
|
701
|
+
return nil
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
var paymentMethodPreview: NSDictionary? = nil
|
|
705
|
+
if let preview = confirmationToken.paymentMethodPreview {
|
|
706
|
+
paymentMethodPreview = [
|
|
707
|
+
"type": Mappers.mapPaymentMethodType(type: preview.type),
|
|
708
|
+
"billingDetails": Mappers.mapFromBillingDetails(billingDetails: preview.billingDetails),
|
|
709
|
+
"allowRedisplay": mapFromAllowRedisplay(allowRedisplay: preview.allowRedisplay) ?? NSNull(),
|
|
710
|
+
"customerId": preview.customerId ?? NSNull(),
|
|
711
|
+
"allResponseFields": preview.allResponseFields
|
|
712
|
+
]
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
var shipping: NSDictionary? = nil
|
|
716
|
+
if let shippingDetails = confirmationToken.shipping {
|
|
717
|
+
var addressDetails: NSDictionary = [:]
|
|
718
|
+
if let address = shippingDetails.address {
|
|
719
|
+
addressDetails = [
|
|
720
|
+
"city": address.city ?? NSNull(),
|
|
721
|
+
"state": address.state ?? NSNull(),
|
|
722
|
+
"country": address.country ?? NSNull(),
|
|
723
|
+
"line1": address.line1 ?? NSNull(),
|
|
724
|
+
"line2": address.line2 ?? NSNull(),
|
|
725
|
+
"postalCode": address.postalCode ?? NSNull(),
|
|
726
|
+
]
|
|
727
|
+
}
|
|
728
|
+
shipping = [
|
|
729
|
+
"address": addressDetails,
|
|
730
|
+
"name": shippingDetails.name ?? NSNull(),
|
|
731
|
+
"phone": shippingDetails.phone ?? NSNull()
|
|
732
|
+
]
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
let token: NSDictionary = [
|
|
736
|
+
"id": confirmationToken.stripeId,
|
|
737
|
+
"created": convertDateToUnixTimestampSeconds(date: confirmationToken.created) ?? NSNull(),
|
|
738
|
+
"expiresAt": convertDateToUnixTimestampSeconds(date: confirmationToken.expiresAt) ?? NSNull(),
|
|
739
|
+
"liveMode": confirmationToken.liveMode,
|
|
740
|
+
"paymentIntentId": confirmationToken.paymentIntentId ?? NSNull(),
|
|
741
|
+
"setupIntentId": confirmationToken.setupIntentId ?? NSNull(),
|
|
742
|
+
"returnURL": confirmationToken.returnURL ?? NSNull(),
|
|
743
|
+
"setupFutureUsage": mapFromSetupFutureUsage(setupFutureUsage: confirmationToken.setupFutureUsage) ?? NSNull(),
|
|
744
|
+
"paymentMethodPreview": paymentMethodPreview ?? NSNull(),
|
|
745
|
+
"shipping": shipping ?? NSNull(),
|
|
746
|
+
"allResponseFields": confirmationToken.allResponseFields
|
|
747
|
+
]
|
|
748
|
+
return token
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
class func mapFromAllowRedisplay(allowRedisplay: STPPaymentMethodAllowRedisplay?) -> String? {
|
|
752
|
+
guard let allowRedisplay = allowRedisplay else {
|
|
753
|
+
return nil
|
|
754
|
+
}
|
|
755
|
+
switch allowRedisplay {
|
|
756
|
+
case .always: return "always"
|
|
757
|
+
case .limited: return "limited"
|
|
758
|
+
case .unspecified: return "unspecified"
|
|
759
|
+
@unknown default: return "unspecified"
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
class func mapFromSetupFutureUsage(setupFutureUsage: STPPaymentIntentSetupFutureUsage?) -> String? {
|
|
764
|
+
guard let setupFutureUsage = setupFutureUsage else {
|
|
765
|
+
return nil
|
|
766
|
+
}
|
|
767
|
+
switch setupFutureUsage {
|
|
768
|
+
case .offSession: return "OffSession"
|
|
769
|
+
case .onSession: return "OnSession"
|
|
770
|
+
case .none: return "None"
|
|
771
|
+
default: return nil
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
class func convertDateToUnixTimestampSeconds(date: Date?) -> NSNumber? {
|
|
776
|
+
guard let date = date else {
|
|
777
|
+
return nil
|
|
778
|
+
}
|
|
779
|
+
return NSNumber(value: date.timeIntervalSince1970)
|
|
780
|
+
}
|
|
781
|
+
|
|
682
782
|
class func mapIntentStatus(status: STPSetupIntentStatus?) -> String {
|
|
683
783
|
if let status = status {
|
|
684
784
|
switch status {
|
|
@@ -961,13 +1061,6 @@ class Mappers {
|
|
|
961
1061
|
return nil
|
|
962
1062
|
}
|
|
963
1063
|
|
|
964
|
-
class func convertDateToUnixTimestampSeconds(date: Date?) -> String? {
|
|
965
|
-
if let date = date {
|
|
966
|
-
let value = date.timeIntervalSince1970
|
|
967
|
-
return String(format: "%.0f", value)
|
|
968
|
-
}
|
|
969
|
-
return nil
|
|
970
|
-
}
|
|
971
1064
|
|
|
972
1065
|
class func mapFromCardValidationState(state: STPCardValidationState?) -> String {
|
|
973
1066
|
if let state = state {
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
@interface StripeSdkEventEmitterCompat : RCTEventEmitter
|
|
7
7
|
- (void)emitOnConfirmHandlerCallback:(NSDictionary *)value;
|
|
8
|
+
- (void)emitOnConfirmationTokenHandlerCallback:(NSDictionary *)value;
|
|
8
9
|
- (void)emitOnFinancialConnectionsEvent:(NSDictionary *)value;
|
|
9
10
|
- (void)emitOnOrderTrackingCallback;
|
|
10
11
|
- (void)emitOnCustomerAdapterFetchPaymentMethodsCallback;
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
return @[
|
|
8
8
|
@"onOrderTrackingCallback",
|
|
9
9
|
@"onConfirmHandlerCallback",
|
|
10
|
+
@"onConfirmationTokenHandlerCallback",
|
|
10
11
|
@"onCustomerAdapterFetchPaymentMethodsCallback",
|
|
11
12
|
@"onCustomerAdapterAttachPaymentMethodCallback",
|
|
12
13
|
@"onCustomerAdapterDetachPaymentMethodCallback",
|
|
@@ -29,6 +30,11 @@
|
|
|
29
30
|
[self sendEventWithName:@"onConfirmHandlerCallback" body:value];
|
|
30
31
|
}
|
|
31
32
|
|
|
33
|
+
- (void)emitOnConfirmationTokenHandlerCallback:(NSDictionary *)value
|
|
34
|
+
{
|
|
35
|
+
[self sendEventWithName:@"onConfirmationTokenHandlerCallback" body:value];
|
|
36
|
+
}
|
|
37
|
+
|
|
32
38
|
- (void)emitOnFinancialConnectionsEvent:(NSDictionary *)value
|
|
33
39
|
{
|
|
34
40
|
[self sendEventWithName:@"onFinancialConnectionsEvent" body:value];
|
|
@@ -11,6 +11,19 @@ internal class PaymentSheetAppearance {
|
|
|
11
11
|
var appearance = PaymentSheet.Appearance()
|
|
12
12
|
guard let userParams = userParams else { return appearance }
|
|
13
13
|
|
|
14
|
+
if #available(iOS 26.0, *), let applyLiquidGlass = userParams[PaymentSheetAppearanceKeys.APPLY_LIQUID_GLASS] as? Bool,
|
|
15
|
+
applyLiquidGlass {
|
|
16
|
+
appearance.applyLiquidGlass()
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if #available(iOS 26.0, *), let navigationBarStyle = userParams[PaymentSheetAppearanceKeys.NAVIGATION_BAR_STYLE] as? String {
|
|
20
|
+
if navigationBarStyle == "plain" {
|
|
21
|
+
appearance.navigationBarStyle = .plain
|
|
22
|
+
} else if navigationBarStyle == "glass" {
|
|
23
|
+
appearance.navigationBarStyle = .glass
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
14
27
|
if let fontParams = userParams[PaymentSheetAppearanceKeys.FONT] as? NSDictionary {
|
|
15
28
|
appearance.font = try buildFont(params: fontParams)
|
|
16
29
|
}
|
|
@@ -426,6 +439,8 @@ private struct PaymentSheetAppearanceKeys {
|
|
|
426
439
|
static let BLUR_RADIUS = "blurRadius"
|
|
427
440
|
static let X = "x"
|
|
428
441
|
static let Y = "y"
|
|
442
|
+
static let APPLY_LIQUID_GLASS = "applyLiquidGlass"
|
|
443
|
+
static let NAVIGATION_BAR_STYLE = "navigationBarStyle"
|
|
429
444
|
|
|
430
445
|
static let PRIMARY_BUTTON = "primaryButton"
|
|
431
446
|
static let TEXT = "text"
|
package/ios/StripeSdk.mm
CHANGED
|
@@ -281,6 +281,13 @@ RCT_EXPORT_METHOD(intentCreationCallback:(nonnull NSDictionary *)result
|
|
|
281
281
|
[StripeSdkImpl.shared intentCreationCallback:result resolver:resolve rejecter:reject];
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
+
RCT_EXPORT_METHOD(confirmationTokenCreationCallback:(nonnull NSDictionary *)result
|
|
285
|
+
resolve:(nonnull RCTPromiseResolveBlock)resolve
|
|
286
|
+
reject:(nonnull RCTPromiseRejectBlock)reject)
|
|
287
|
+
{
|
|
288
|
+
[StripeSdkImpl.shared confirmationTokenCreationCallback:result resolver:resolve rejecter:reject];
|
|
289
|
+
}
|
|
290
|
+
|
|
284
291
|
RCT_EXPORT_METHOD(isCardInWallet:(nonnull NSDictionary *)params
|
|
285
292
|
resolve:(nonnull RCTPromiseResolveBlock)resolve
|
|
286
293
|
reject:(nonnull RCTPromiseRejectBlock)reject)
|
|
@@ -2,6 +2,7 @@ import Foundation
|
|
|
2
2
|
|
|
3
3
|
@objc public protocol StripeSdkEmitter {
|
|
4
4
|
func emitOnConfirmHandlerCallback(_ value: [String: Any])
|
|
5
|
+
func emitOnConfirmationTokenHandlerCallback(_ value: [String: Any])
|
|
5
6
|
func emitOnFinancialConnectionsEvent(_ value: [String: Any])
|
|
6
7
|
func emitOnOrderTrackingCallback()
|
|
7
8
|
func emitOnCustomerAdapterFetchPaymentMethodsCallback()
|
|
@@ -22,15 +22,24 @@ extension StripeSdkImpl {
|
|
|
22
22
|
resolve(Errors.createError(ErrorType.Failed, "One of `paymentIntentClientSecret`, `setupIntentClientSecret`, or `intentConfiguration.mode` is required"))
|
|
23
23
|
return
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
let hasConfirmHandler = intentConfig.object(forKey: "confirmHandler") != nil
|
|
26
|
+
let hasConfirmationTokenHandler = intentConfig.object(forKey: "confirmationTokenConfirmHandler") != nil
|
|
27
|
+
|
|
28
|
+
if !hasConfirmHandler && !hasConfirmationTokenHandler {
|
|
29
|
+
resolve(Errors.createError(ErrorType.Failed, "You must provide either `intentConfiguration.confirmHandler` or `intentConfiguration.confirmationTokenConfirmHandler` if you are not passing an intent client secret"))
|
|
30
|
+
return
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if hasConfirmHandler && hasConfirmationTokenHandler {
|
|
34
|
+
resolve(Errors.createError(ErrorType.Failed, "You must provide either `confirmHandler` or `confirmationTokenConfirmHandler`, but not both"))
|
|
27
35
|
return
|
|
28
36
|
}
|
|
29
37
|
let captureMethodString = intentConfig["captureMethod"] as? String
|
|
30
38
|
let intentConfig = buildIntentConfiguration(
|
|
31
39
|
modeParams: modeParams,
|
|
32
40
|
paymentMethodTypes: intentConfig["paymentMethodTypes"] as? [String],
|
|
33
|
-
captureMethod: mapCaptureMethod(captureMethodString)
|
|
41
|
+
captureMethod: mapCaptureMethod(captureMethodString),
|
|
42
|
+
useConfirmationTokenCallback: hasConfirmationTokenHandler
|
|
34
43
|
)
|
|
35
44
|
|
|
36
45
|
guard let configuration = buildEmbeddedPaymentElementConfiguration(params: configuration).configuration else {
|
|
@@ -103,11 +112,24 @@ extension StripeSdkImpl {
|
|
|
103
112
|
))
|
|
104
113
|
return
|
|
105
114
|
}
|
|
115
|
+
let hasConfirmHandler = intentConfig.object(forKey: "confirmHandler") != nil
|
|
116
|
+
let hasConfirmationTokenHandler = intentConfig.object(forKey: "confirmationTokenConfirmHandler") != nil
|
|
117
|
+
|
|
118
|
+
if !hasConfirmHandler && !hasConfirmationTokenHandler {
|
|
119
|
+
resolve(Errors.createError(ErrorType.Failed, "You must provide either `intentConfiguration.confirmHandler` or `intentConfiguration.confirmationTokenConfirmHandler` if you are not passing an intent client secret"))
|
|
120
|
+
return
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if hasConfirmHandler && hasConfirmationTokenHandler {
|
|
124
|
+
resolve(Errors.createError(ErrorType.Failed, "You must provide either `confirmHandler` or `confirmationTokenConfirmHandler`, but not both"))
|
|
125
|
+
return
|
|
126
|
+
}
|
|
106
127
|
let captureMethodString = intentConfig["captureMethod"] as? String
|
|
107
128
|
let intentConfiguration = buildIntentConfiguration(
|
|
108
129
|
modeParams: modeParams,
|
|
109
130
|
paymentMethodTypes: intentConfig["paymentMethodTypes"] as? [String],
|
|
110
|
-
captureMethod: mapCaptureMethod(captureMethodString)
|
|
131
|
+
captureMethod: mapCaptureMethod(captureMethodString),
|
|
132
|
+
useConfirmationTokenCallback: hasConfirmationTokenHandler
|
|
111
133
|
)
|
|
112
134
|
|
|
113
135
|
Task {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
import Foundation
|
|
9
|
-
@_spi(ExperimentalAllowsRemovalOfLastSavedPaymentMethodAPI) @_spi(CustomerSessionBetaAccess) @_spi(EmbeddedPaymentElementPrivateBeta) @_spi(STP) @_spi(PaymentMethodOptionsSetupFutureUsagePreview) @_spi(CustomPaymentMethodsBeta) import StripePaymentSheet
|
|
9
|
+
@_spi(ExperimentalAllowsRemovalOfLastSavedPaymentMethodAPI) @_spi(CustomerSessionBetaAccess) @_spi(EmbeddedPaymentElementPrivateBeta) @_spi(STP) @_spi(PaymentMethodOptionsSetupFutureUsagePreview) @_spi(CustomPaymentMethodsBeta) @_spi(ConfirmationTokensPublicPreview) import StripePaymentSheet
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
extension StripeSdkImpl {
|
|
@@ -212,15 +212,24 @@ extension StripeSdkImpl {
|
|
|
212
212
|
resolve(Errors.createError(ErrorType.Failed, "One of `paymentIntentClientSecret`, `setupIntentClientSecret`, or `intentConfiguration.mode` is required"))
|
|
213
213
|
return
|
|
214
214
|
}
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
let hasConfirmHandler = intentConfiguration.object(forKey: "confirmHandler") != nil
|
|
216
|
+
let hasConfirmationTokenHandler = intentConfiguration.object(forKey: "confirmationTokenConfirmHandler") != nil
|
|
217
|
+
|
|
218
|
+
if !hasConfirmHandler && !hasConfirmationTokenHandler {
|
|
219
|
+
resolve(Errors.createError(ErrorType.Failed, "You must provide either `intentConfiguration.confirmHandler` or `intentConfiguration.confirmationTokenConfirmHandler` if you are not passing an intent client secret"))
|
|
220
|
+
return
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if hasConfirmHandler && hasConfirmationTokenHandler {
|
|
224
|
+
resolve(Errors.createError(ErrorType.Failed, "You must provide either `confirmHandler` or `confirmationTokenConfirmHandler`, but not both"))
|
|
217
225
|
return
|
|
218
226
|
}
|
|
219
227
|
let captureMethodString = intentConfiguration["captureMethod"] as? String
|
|
220
228
|
let intentConfig = buildIntentConfiguration(
|
|
221
229
|
modeParams: modeParams,
|
|
222
230
|
paymentMethodTypes: intentConfiguration["paymentMethodTypes"] as? [String],
|
|
223
|
-
captureMethod: mapCaptureMethod(captureMethodString)
|
|
231
|
+
captureMethod: mapCaptureMethod(captureMethodString),
|
|
232
|
+
useConfirmationTokenCallback: hasConfirmationTokenHandler
|
|
224
233
|
)
|
|
225
234
|
|
|
226
235
|
if params["customFlow"] as? Bool == true {
|
|
@@ -292,7 +301,8 @@ extension StripeSdkImpl {
|
|
|
292
301
|
func buildIntentConfiguration(
|
|
293
302
|
modeParams: NSDictionary,
|
|
294
303
|
paymentMethodTypes: [String]?,
|
|
295
|
-
captureMethod: PaymentSheet.IntentConfiguration.CaptureMethod
|
|
304
|
+
captureMethod: PaymentSheet.IntentConfiguration.CaptureMethod,
|
|
305
|
+
useConfirmationTokenCallback: Bool
|
|
296
306
|
) -> PaymentSheet.IntentConfiguration {
|
|
297
307
|
var mode: PaymentSheet.IntentConfiguration.Mode
|
|
298
308
|
if let amount = modeParams["amount"] as? Int {
|
|
@@ -310,16 +320,28 @@ extension StripeSdkImpl {
|
|
|
310
320
|
)
|
|
311
321
|
}
|
|
312
322
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
+
if useConfirmationTokenCallback {
|
|
324
|
+
return PaymentSheet.IntentConfiguration.init(
|
|
325
|
+
mode: mode,
|
|
326
|
+
paymentMethodTypes: paymentMethodTypes,
|
|
327
|
+
confirmationTokenConfirmHandler: { confirmationToken, intentCreationCallback in
|
|
328
|
+
self.paymentSheetConfirmationTokenIntentCreationCallback = intentCreationCallback
|
|
329
|
+
self.emitter?.emitOnConfirmationTokenHandlerCallback([
|
|
330
|
+
"confirmationToken": Mappers.mapFromConfirmationToken(confirmationToken) ?? NSNull()
|
|
331
|
+
])
|
|
332
|
+
})
|
|
333
|
+
} else {
|
|
334
|
+
return PaymentSheet.IntentConfiguration.init(
|
|
335
|
+
mode: mode,
|
|
336
|
+
paymentMethodTypes: paymentMethodTypes,
|
|
337
|
+
confirmHandler: { paymentMethod, shouldSavePaymentMethod, intentCreationCallback in
|
|
338
|
+
self.paymentSheetIntentCreationCallback = intentCreationCallback
|
|
339
|
+
self.emitter?.emitOnConfirmHandlerCallback([
|
|
340
|
+
"paymentMethod": Mappers.mapFromPaymentMethod(paymentMethod) ?? NSNull(),
|
|
341
|
+
"shouldSavePaymentMethod": shouldSavePaymentMethod
|
|
342
|
+
])
|
|
343
|
+
})
|
|
344
|
+
}
|
|
323
345
|
}
|
|
324
346
|
|
|
325
347
|
func buildPaymentMethodOptions(paymentMethodOptionsParams: NSDictionary) -> PaymentSheet.IntentConfiguration.Mode.PaymentMethodOptions? {
|
package/ios/StripeSdkImpl.swift
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import PassKit
|
|
2
2
|
@_spi(DashboardOnly) @_spi(STP) import Stripe
|
|
3
3
|
@_spi(EmbeddedPaymentElementPrivateBeta) import StripePaymentSheet
|
|
4
|
-
@_spi(STP) import StripePayments
|
|
4
|
+
@_spi(STP) @_spi(ConfirmationTokensPublicPreview) import StripePayments
|
|
5
5
|
import StripeFinancialConnections
|
|
6
6
|
import Foundation
|
|
7
7
|
|
|
@@ -18,6 +18,7 @@ public class StripeSdkImpl: NSObject, UIAdaptivePresentationControllerDelegate {
|
|
|
18
18
|
internal var paymentSheet: PaymentSheet?
|
|
19
19
|
internal var paymentSheetFlowController: PaymentSheet.FlowController?
|
|
20
20
|
var paymentSheetIntentCreationCallback: ((Result<String, Error>) -> Void)?
|
|
21
|
+
var paymentSheetConfirmationTokenIntentCreationCallback: ((Result<String, Error>) -> Void)?
|
|
21
22
|
|
|
22
23
|
var urlScheme: String? = nil
|
|
23
24
|
|
|
@@ -138,6 +139,22 @@ public class StripeSdkImpl: NSObject, UIAdaptivePresentationControllerDelegate {
|
|
|
138
139
|
}
|
|
139
140
|
}
|
|
140
141
|
|
|
142
|
+
@objc(confirmationTokenCreationCallback:resolver:rejecter:)
|
|
143
|
+
@MainActor public func confirmationTokenCreationCallback(result: NSDictionary, resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
144
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
|
|
145
|
+
guard let paymentSheetConfirmationTokenIntentCreationCallback = self.paymentSheetConfirmationTokenIntentCreationCallback else {
|
|
146
|
+
resolve(Errors.createError(ErrorType.Failed, "No confirmation token intent creation callback was set"))
|
|
147
|
+
return
|
|
148
|
+
}
|
|
149
|
+
if let clientSecret = result["clientSecret"] as? String {
|
|
150
|
+
paymentSheetConfirmationTokenIntentCreationCallback(.success(clientSecret))
|
|
151
|
+
} else {
|
|
152
|
+
let errorParams = result["error"] as? NSDictionary
|
|
153
|
+
let error = ConfirmationError.init(errorMessage: errorParams?["localizedMessage"] as? String ?? "An unknown error occurred.")
|
|
154
|
+
paymentSheetConfirmationTokenIntentCreationCallback(.failure(error))
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
141
158
|
@objc(customPaymentMethodResultCallback:resolver:rejecter:)
|
|
142
159
|
@MainActor public func customPaymentMethodResultCallback(result: NSDictionary, resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
143
160
|
rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.AddToWalletButton=AddToWalletButton;var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _NativeAddToWalletButton=_interopRequireDefault(require("../specs/NativeAddToWalletButton"));var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="/Users/
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.AddToWalletButton=AddToWalletButton;var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _NativeAddToWalletButton=_interopRequireDefault(require("../specs/NativeAddToWalletButton"));var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="/Users/jaynewstrom/stripe/stripe-react-native/src/components/AddToWalletButton.tsx";var _excluded=["onComplete"];function AddToWalletButton(_ref){var onComplete=_ref.onComplete,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);return(0,_jsxRuntime.jsx)(_NativeAddToWalletButton.default,Object.assign({},props,{onCompleteAction:function onCompleteAction(value){return onComplete(value.nativeEvent);}}));}
|
|
2
2
|
//# sourceMappingURL=AddToWalletButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_NativeAddToWalletButton","_jsxRuntime","_jsxFileName","_excluded","AddToWalletButton","_ref","onComplete","props","_objectWithoutProperties2","default","jsx","Object","assign","onCompleteAction","value","nativeEvent"],"sourceRoot":"../../../src","sources":["components/AddToWalletButton.tsx"],"mappings":"wSAAA,IAAAA,MAAA,CAAAC,sBAAA,CAAAC,OAAA,WAcA,IAAAC,wBAAA,CAAAF,sBAAA,CAAAC,OAAA,sCAAuE,IAAAE,WAAA,CAAAF,OAAA,0BAAAG,YAAA,
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_NativeAddToWalletButton","_jsxRuntime","_jsxFileName","_excluded","AddToWalletButton","_ref","onComplete","props","_objectWithoutProperties2","default","jsx","Object","assign","onCompleteAction","value","nativeEvent"],"sourceRoot":"../../../src","sources":["components/AddToWalletButton.tsx"],"mappings":"wSAAA,IAAAA,MAAA,CAAAC,sBAAA,CAAAC,OAAA,WAcA,IAAAC,wBAAA,CAAAF,sBAAA,CAAAC,OAAA,sCAAuE,IAAAE,WAAA,CAAAF,OAAA,0BAAAG,YAAA,0FAAAC,SAAA,gBAgEhE,QAAS,CAAAC,iBAAiBA,CAAAC,IAAA,CAAkC,IAA/B,CAAAC,UAAU,CAAAD,IAAA,CAAVC,UAAU,CAAKC,KAAK,IAAAC,yBAAA,CAAAC,OAAA,EAAAJ,IAAA,CAAAF,SAAA,EACtD,MACE,GAAAF,WAAA,CAAAS,GAAA,EAACV,wBAAA,CAAAS,OAAuB,CAAAE,MAAA,CAAAC,MAAA,IAClBL,KAAK,EACTM,gBAAgB,CAAE,QAAlB,CAAAA,gBAAgBA,CACdC,KAEE,QACC,CAAAR,UAAU,CAACQ,KAAK,CAACC,WAAW,CAAC,EAAC,EACpC,CAAC,CAEN","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.AddressSheet=AddressSheet;var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _NativeAddressSheet=_interopRequireDefault(require("../specs/NativeAddressSheet"));var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="/Users/
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.AddressSheet=AddressSheet;var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _NativeAddressSheet=_interopRequireDefault(require("../specs/NativeAddressSheet"));var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="/Users/jaynewstrom/stripe/stripe-react-native/src/components/AddressSheet.tsx";var _excluded=["onSubmit","onError"];function AddressSheet(_ref){var onSubmit=_ref.onSubmit,onError=_ref.onError,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);return(0,_jsxRuntime.jsx)(_NativeAddressSheet.default,Object.assign({},props,{onSubmitAction:function onSubmitAction(event){return onSubmit(event.nativeEvent.result);},onErrorAction:function onErrorAction(event){return onError(event.nativeEvent.error);}}));}
|
|
2
2
|
//# sourceMappingURL=AddressSheet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_NativeAddressSheet","_jsxRuntime","_jsxFileName","_excluded","AddressSheet","_ref","onSubmit","onError","props","_objectWithoutProperties2","default","jsx","Object","assign","onSubmitAction","event","nativeEvent","result","onErrorAction","error"],"sourceRoot":"../../../src","sources":["components/AddressSheet.tsx"],"mappings":"8RAAA,IAAAA,MAAA,CAAAC,sBAAA,CAAAC,OAAA,WAQA,IAAAC,mBAAA,CAAAF,sBAAA,CAAAC,OAAA,iCAA6D,IAAAE,WAAA,CAAAF,OAAA,0BAAAG,YAAA
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_NativeAddressSheet","_jsxRuntime","_jsxFileName","_excluded","AddressSheet","_ref","onSubmit","onError","props","_objectWithoutProperties2","default","jsx","Object","assign","onSubmitAction","event","nativeEvent","result","onErrorAction","error"],"sourceRoot":"../../../src","sources":["components/AddressSheet.tsx"],"mappings":"8RAAA,IAAAA,MAAA,CAAAC,sBAAA,CAAAC,OAAA,WAQA,IAAAC,mBAAA,CAAAF,sBAAA,CAAAC,OAAA,iCAA6D,IAAAE,WAAA,CAAAF,OAAA,0BAAAG,YAAA,qFAAAC,SAAA,wBA4DtD,QAAS,CAAAC,YAAYA,CAAAC,IAAA,CAAyC,IAAtC,CAAAC,QAAQ,CAAAD,IAAA,CAARC,QAAQ,CAAEC,OAAO,CAAAF,IAAA,CAAPE,OAAO,CAAKC,KAAK,IAAAC,yBAAA,CAAAC,OAAA,EAAAL,IAAA,CAAAF,SAAA,EACxD,MACE,GAAAF,WAAA,CAAAU,GAAA,EAACX,mBAAA,CAAAU,OAAkB,CAAAE,MAAA,CAAAC,MAAA,IACbL,KAAK,EACTM,cAAc,CAAE,QAAhB,CAAAA,cAAcA,CAAGC,KAAK,QAAK,CAAAT,QAAQ,CAACS,KAAK,CAACC,WAAW,CAACC,MAAM,CAAC,EAAC,CAC9DC,aAAa,CAAE,QAAf,CAAAA,aAAaA,CAAGH,KAAK,QAAK,CAAAR,OAAO,CAACQ,KAAK,CAACC,WAAW,CAACG,KAAK,CAAC,EAAC,EAC5D,CAAC,CAEN","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.AuBECSDebitForm=AuBECSDebitForm;var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _NativeAuBECSDebitForm=_interopRequireDefault(require("../specs/NativeAuBECSDebitForm"));var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="/Users/
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.AuBECSDebitForm=AuBECSDebitForm;var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _NativeAuBECSDebitForm=_interopRequireDefault(require("../specs/NativeAuBECSDebitForm"));var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="/Users/jaynewstrom/stripe/stripe-react-native/src/components/AuBECSDebitForm.tsx";var _excluded=["onComplete","companyName","formStyle"];function AuBECSDebitForm(_ref){var onComplete=_ref.onComplete,companyName=_ref.companyName,formStyle=_ref.formStyle,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);return(0,_jsxRuntime.jsx)(_NativeAuBECSDebitForm.default,Object.assign({onCompleteAction:function onCompleteAction(value){return onComplete(value.nativeEvent);},companyName:companyName,formStyle:Object.assign({},formStyle)},props));}
|
|
2
2
|
//# sourceMappingURL=AuBECSDebitForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_NativeAuBECSDebitForm","_jsxRuntime","_jsxFileName","_excluded","AuBECSDebitForm","_ref","onComplete","companyName","formStyle","props","_objectWithoutProperties2","default","jsx","Object","assign","onCompleteAction","value","nativeEvent"],"sourceRoot":"../../../src","sources":["components/AuBECSDebitForm.tsx"],"mappings":"oSAAA,IAAAA,MAAA,CAAAC,sBAAA,CAAAC,OAAA,WAEA,IAAAC,sBAAA,CAAAF,sBAAA,CAAAC,OAAA,oCAAmE,IAAAE,WAAA,CAAAF,OAAA,0BAAAG,YAAA,
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_NativeAuBECSDebitForm","_jsxRuntime","_jsxFileName","_excluded","AuBECSDebitForm","_ref","onComplete","companyName","formStyle","props","_objectWithoutProperties2","default","jsx","Object","assign","onCompleteAction","value","nativeEvent"],"sourceRoot":"../../../src","sources":["components/AuBECSDebitForm.tsx"],"mappings":"oSAAA,IAAAA,MAAA,CAAAC,sBAAA,CAAAC,OAAA,WAEA,IAAAC,sBAAA,CAAAF,sBAAA,CAAAC,OAAA,oCAAmE,IAAAE,WAAA,CAAAF,OAAA,0BAAAG,YAAA,wFAAAC,SAAA,0CA6B5D,QAAS,CAAAC,eAAeA,CAAAC,IAAA,CAKrB,IAJR,CAAAC,UAAU,CAAAD,IAAA,CAAVC,UAAU,CACVC,WAAW,CAAAF,IAAA,CAAXE,WAAW,CACXC,SAAS,CAAAH,IAAA,CAATG,SAAS,CACNC,KAAK,IAAAC,yBAAA,CAAAC,OAAA,EAAAN,IAAA,CAAAF,SAAA,EAER,MACE,GAAAF,WAAA,CAAAW,GAAA,EAACZ,sBAAA,CAAAW,OAAqB,CAAAE,MAAA,CAAAC,MAAA,EACpBC,gBAAgB,CAAE,QAAlB,CAAAA,gBAAgBA,CAAGC,KAAK,QAAK,CAAAV,UAAU,CAACU,KAAK,CAACC,WAAW,CAAC,EAAC,CAC3DV,WAAW,CAAEA,WAAY,CACzBC,SAAS,CAAAK,MAAA,CAAAC,MAAA,IAAON,SAAS,CAAG,EACxBC,KAAK,CACV,CAAC,CAEN","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.CardField=void 0;var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _helpers=require("../helpers");var _NativeCardField=_interopRequireWildcard(require("../specs/NativeCardField"));var _jsxRuntime=require("react/jsx-runtime");var _excluded=["onCardChange","onFocus","onBlur","cardStyle","placeholders","autofocus","postalCodeEnabled","disabled","dangerouslyGetFullCardDetails"];var _this=this,_jsxFileName="/Users/
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.CardField=void 0;var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _helpers=require("../helpers");var _NativeCardField=_interopRequireWildcard(require("../specs/NativeCardField"));var _jsxRuntime=require("react/jsx-runtime");var _excluded=["onCardChange","onFocus","onBlur","cardStyle","placeholders","autofocus","postalCodeEnabled","disabled","dangerouslyGetFullCardDetails"];var _this=this,_jsxFileName="/Users/jaynewstrom/stripe/stripe-react-native/src/components/CardField.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&{}.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var CardField=exports.CardField=(0,_react.forwardRef)(function(_ref,ref){var onCardChange=_ref.onCardChange,onFocus=_ref.onFocus,onBlur=_ref.onBlur,cardStyle=_ref.cardStyle,placeholders=_ref.placeholders,autofocus=_ref.autofocus,postalCodeEnabled=_ref.postalCodeEnabled,disabled=_ref.disabled,dangerouslyGetFullCardDetails=_ref.dangerouslyGetFullCardDetails,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);var inputRef=(0,_react.useRef)(null);var onCardChangeHandler=(0,_react.useCallback)(function(event){var card=event.nativeEvent.card;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] ⚠️ 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||onCardChange(data);},[onCardChange]);var onFocusHandler=(0,_react.useCallback)(function(event){var focusedField=event.nativeEvent.focusedField;if(focusedField){(0,_helpers.focusInput)(inputRef.current);onFocus==null||onFocus(focusedField);}else{onBlur==null||onBlur();}},[onFocus,onBlur]);var focus=function focus(){_NativeCardField.Commands.focus(inputRef.current);};var blur=function blur(){_NativeCardField.Commands.blur(inputRef.current);};var clear=function clear(){_NativeCardField.Commands.clear(inputRef.current);};(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(0,_jsxRuntime.jsx)(_NativeCardField.default,Object.assign({ref:inputRef,onCardChange:onCardChangeHandler,onFocusChange:onFocusHandler,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},autofocus:autofocus!=null?autofocus:false,postalCodeEnabled:postalCodeEnabled!=null?postalCodeEnabled:true,disabled:disabled!=null?disabled:false,dangerouslyGetFullCardDetails:dangerouslyGetFullCardDetails!=null?dangerouslyGetFullCardDetails:false},props));});
|
|
2
2
|
//# sourceMappingURL=CardField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_helpers","_NativeCardField","_jsxRuntime","_excluded","_this","_jsxFileName","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","CardField","exports","forwardRef","_ref","ref","onCardChange","onFocus","onBlur","cardStyle","placeholders","autofocus","postalCodeEnabled","disabled","dangerouslyGetFullCardDetails","props","_objectWithoutProperties2","inputRef","useRef","onCardChangeHandler","useCallback","event","card","nativeEvent","data","last4","expiryMonth","expiryYear","complete","brand","validExpiryDate","validNumber","validCVC","postalCode","number","cvc","__DEV__","console","warn","onFocusHandler","focusedField","focusInput","current","focus","Commands","blur","clear","useImperativeHandle","useLayoutEffect","inputRefValue","registerInput","unregisterInput","currentlyFocusedInput","jsx","assign","onFocusChange","backgroundColor","borderColor","borderWidth","borderRadius","cursorColor","fontSize","placeholderColor","textColor","textErrorColor","fontFamily","expiration"],"sourceRoot":"../../../src","sources":["components/CardField.tsx"],"mappings":"qRAAA,IAAAA,MAAA,CAAAC,uBAAA,CAAAC,OAAA,WAaA,IAAAC,QAAA,CAAAD,OAAA,eAMA,IAAAE,gBAAA,CAAAH,uBAAA,CAAAC,OAAA,8BAGkC,IAAAG,WAAA,CAAAH,OAAA,0BAAAI,SAAA,+IAAAC,KAAA,MAAAC,YAAA,
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_helpers","_NativeCardField","_jsxRuntime","_excluded","_this","_jsxFileName","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","CardField","exports","forwardRef","_ref","ref","onCardChange","onFocus","onBlur","cardStyle","placeholders","autofocus","postalCodeEnabled","disabled","dangerouslyGetFullCardDetails","props","_objectWithoutProperties2","inputRef","useRef","onCardChangeHandler","useCallback","event","card","nativeEvent","data","last4","expiryMonth","expiryYear","complete","brand","validExpiryDate","validNumber","validCVC","postalCode","number","cvc","__DEV__","console","warn","onFocusHandler","focusedField","focusInput","current","focus","Commands","blur","clear","useImperativeHandle","useLayoutEffect","inputRefValue","registerInput","unregisterInput","currentlyFocusedInput","jsx","assign","onFocusChange","backgroundColor","borderColor","borderWidth","borderRadius","cursorColor","fontSize","placeholderColor","textColor","textErrorColor","fontFamily","expiration"],"sourceRoot":"../../../src","sources":["components/CardField.tsx"],"mappings":"qRAAA,IAAAA,MAAA,CAAAC,uBAAA,CAAAC,OAAA,WAaA,IAAAC,QAAA,CAAAD,OAAA,eAMA,IAAAE,gBAAA,CAAAH,uBAAA,CAAAC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,CAAE,CACFvD,YAAY,CAAE,CACZwB,MAAM,CAAExB,YAAY,cAAZA,YAAY,CAAEwB,MAAM,CAC5BgC,UAAU,CAAExD,YAAY,cAAZA,YAAY,CAAEwD,UAAU,CACpC/B,GAAG,CAAEzB,YAAY,cAAZA,YAAY,CAAEyB,GAAG,CACtBF,UAAU,CAAEvB,YAAY,cAAZA,YAAY,CAAEuB,UAC5B,CAAE,CACFtB,SAAS,CAAEA,SAAS,OAATA,SAAS,CAAI,KAAM,CAC9BC,iBAAiB,CAAEA,iBAAiB,OAAjBA,iBAAiB,CAAI,IAAK,CAC7CC,QAAQ,CAAEA,QAAQ,OAARA,QAAQ,CAAI,KAAM,CAC5BC,6BAA6B,CAAEA,6BAA6B,OAA7BA,6BAA6B,CAAI,KAAM,EAClEC,KAAK,CACV,CAAC,CAEN,CACF,CAAC","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.CardForm=void 0;var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _NativeCardForm=_interopRequireWildcard(require("../specs/NativeCardForm"));var _helpers=require("../helpers");var _jsxRuntime=require("react/jsx-runtime");var _excluded=["onFormComplete","cardStyle","placeholders","defaultValues","autofocus","dangerouslyGetFullCardDetails","disabled"];var _this=this,_jsxFileName="/Users/
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.CardForm=void 0;var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _NativeCardForm=_interopRequireWildcard(require("../specs/NativeCardForm"));var _helpers=require("../helpers");var _jsxRuntime=require("react/jsx-runtime");var _excluded=["onFormComplete","cardStyle","placeholders","defaultValues","autofocus","dangerouslyGetFullCardDetails","disabled"];var _this=this,_jsxFileName="/Users/jaynewstrom/stripe/stripe-react-native/src/components/CardForm.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&{}.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var CardForm=exports.CardForm=(0,_react.forwardRef)(function(_ref,ref){var onFormComplete=_ref.onFormComplete,cardStyle=_ref.cardStyle,placeholders=_ref.placeholders,defaultValues=_ref.defaultValues,autofocus=_ref.autofocus,dangerouslyGetFullCardDetails=_ref.dangerouslyGetFullCardDetails,disabled=_ref.disabled,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);var inputRef=(0,_react.useRef)(null);var onFormCompleteHandler=(0,_react.useCallback)(function(event){var card=event.nativeEvent.card;var data={last4:card.last4,expiryMonth:card.expiryMonth,expiryYear:card.expiryYear,complete:card.complete,brand:card.brand,country:card.country,postalCode:card.postalCode};if(card.hasOwnProperty('number')||card.hasOwnProperty('cvc')){data.number=card.number||'';data.cvc=card.cvc||'';if(__DEV__&&onFormComplete&&card.complete){console.warn(`[stripe-react-native] ⚠️ 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`);}}onFormComplete==null||onFormComplete(data);},[onFormComplete]);var focus=function focus(){_NativeCardForm.Commands.focus(inputRef.current);};var blur=function blur(){_NativeCardForm.Commands.blur(inputRef.current);};(0,_react.useImperativeHandle)(ref,function(){return{focus:focus,blur:blur};});var onFocusHandler=(0,_react.useCallback)(function(event){var focusedField=event.nativeEvent.focusedField;if(focusedField){(0,_helpers.focusInput)(inputRef.current);}},[]);(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(0,_jsxRuntime.jsx)(_NativeCardForm.default,Object.assign({ref:inputRef,onFormComplete:onFormCompleteHandler,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},defaultValues:Object.assign({},defaultValues!=null?defaultValues:{}),onFocusChange:onFocusHandler,autofocus:autofocus!=null?autofocus:false,dangerouslyGetFullCardDetails:dangerouslyGetFullCardDetails!=null?dangerouslyGetFullCardDetails:false,disabled:disabled!=null?disabled:false,postalCodeEnabled:true},props));});
|
|
2
2
|
//# sourceMappingURL=CardForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_NativeCardForm","_helpers","_jsxRuntime","_excluded","_this","_jsxFileName","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","CardForm","exports","forwardRef","_ref","ref","onFormComplete","cardStyle","placeholders","defaultValues","autofocus","dangerouslyGetFullCardDetails","disabled","props","_objectWithoutProperties2","inputRef","useRef","onFormCompleteHandler","useCallback","event","card","nativeEvent","data","last4","expiryMonth","expiryYear","complete","brand","country","postalCode","number","cvc","__DEV__","console","warn","focus","Commands","current","blur","useImperativeHandle","onFocusHandler","focusedField","focusInput","useLayoutEffect","inputRefValue","registerInput","unregisterInput","currentlyFocusedInput","jsx","assign","backgroundColor","borderColor","borderWidth","borderRadius","cursorColor","fontSize","placeholderColor","textColor","textErrorColor","fontFamily","expiration","onFocusChange","postalCodeEnabled"],"sourceRoot":"../../../src","sources":["components/CardForm.tsx"],"mappings":"oRAAA,IAAAA,MAAA,CAAAC,uBAAA,CAAAC,OAAA,WAaA,IAAAC,eAAA,CAAAF,uBAAA,CAAAC,OAAA,6BACA,IAAAE,QAAA,CAAAF,OAAA,eAKoB,IAAAG,WAAA,CAAAH,OAAA,0BAAAI,SAAA,0HAAAC,KAAA,MAAAC,YAAA,
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_NativeCardForm","_helpers","_jsxRuntime","_excluded","_this","_jsxFileName","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","CardForm","exports","forwardRef","_ref","ref","onFormComplete","cardStyle","placeholders","defaultValues","autofocus","dangerouslyGetFullCardDetails","disabled","props","_objectWithoutProperties2","inputRef","useRef","onFormCompleteHandler","useCallback","event","card","nativeEvent","data","last4","expiryMonth","expiryYear","complete","brand","country","postalCode","number","cvc","__DEV__","console","warn","focus","Commands","current","blur","useImperativeHandle","onFocusHandler","focusedField","focusInput","useLayoutEffect","inputRefValue","registerInput","unregisterInput","currentlyFocusedInput","jsx","assign","backgroundColor","borderColor","borderWidth","borderRadius","cursorColor","fontSize","placeholderColor","textColor","textErrorColor","fontFamily","expiration","onFocusChange","postalCodeEnabled"],"sourceRoot":"../../../src","sources":["components/CardForm.tsx"],"mappings":"oRAAA,IAAAA,MAAA,CAAAC,uBAAA,CAAAC,OAAA,WAaA,IAAAC,eAAA,CAAAF,uBAAA,CAAAC,OAAA,6BACA,IAAAE,QAAA,CAAAF,OAAA,eAKoB,IAAAG,WAAA,CAAAH,OAAA,0BAAAI,SAAA,0HAAAC,KAAA,MAAAC,YAAA,sFAAAC,yBAAAC,CAAA,wBAAAC,OAAA,iBAAAC,CAAA,KAAAD,OAAA,GAAAE,CAAA,KAAAF,OAAA,UAAAF,wBAAA,UAAAA,yBAAAC,CAAA,SAAAA,CAAA,CAAAG,CAAA,CAAAD,CAAA,IAAAF,CAAA,YAAAT,wBAAAS,CAAA,CAAAE,CAAA,MAAAA,CAAA,EAAAF,CAAA,EAAAA,CAAA,CAAAI,UAAA,QAAAJ,CAAA,WAAAA,CAAA,mBAAAA,CAAA,qBAAAA,CAAA,QAAAK,OAAA,CAAAL,CAAA,MAAAG,CAAA,CAAAJ,wBAAA,CAAAG,CAAA,KAAAC,CAAA,EAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,SAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,MAAAQ,CAAA,EAAAC,SAAA,OAAAC,CAAA,CAAAC,MAAA,CAAAC,cAAA,EAAAD,MAAA,CAAAE,wBAAA,SAAAC,CAAA,IAAAd,CAAA,gBAAAc,CAAA,KAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,CAAAc,CAAA,OAAAG,CAAA,CAAAP,CAAA,CAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,CAAAc,CAAA,OAAAG,CAAA,GAAAA,CAAA,CAAAV,GAAA,EAAAU,CAAA,CAAAC,GAAA,EAAAP,MAAA,CA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