@stripe/stripe-react-native 0.35.0 → 0.36.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.
- package/CHANGELOG.md +20 -1
- package/README.md +4 -0
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +13 -5
- package/android/src/main/java/com/reactnativestripesdk/CardFieldViewManager.kt +6 -0
- package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +9 -1
- package/android/src/main/java/com/reactnativestripesdk/CardFormViewManager.kt +6 -0
- package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonView.kt +2 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +17 -2
- package/android/src/main/java/com/reactnativestripesdk/customersheet/CustomerSheetFragment.kt +2 -2
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +26 -1
- package/ios/CardFieldManager.m +1 -0
- package/ios/CardFieldView.swift +8 -0
- package/ios/CardFormManager.m +1 -0
- package/ios/CardFormView.swift +7 -0
- package/ios/CustomerSheet/CustomerSheetUtils.swift +5 -1
- package/ios/Mappers.swift +25 -0
- package/ios/StripeSdk+CustomerSheet.swift +3 -1
- package/ios/StripeSdk+PaymentSheet.swift +4 -0
- package/jest/mock.js +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/types/Common.js +1 -1
- package/lib/commonjs/types/Common.js.map +1 -1
- package/lib/commonjs/types/CustomerSheet.js.map +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/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/types/Common.js +1 -1
- package/lib/module/types/Common.js.map +1 -1
- package/lib/module/types/CustomerSheet.js.map +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/components/CardField.d.ts +4 -1
- package/lib/typescript/src/components/CardForm.d.ts +4 -1
- package/lib/typescript/src/types/Common.d.ts +11 -0
- package/lib/typescript/src/types/CustomerSheet.d.ts +4 -1
- package/lib/typescript/src/types/PaymentSheet.d.ts +8 -1
- package/lib/typescript/src/types/index.d.ts +1 -0
- package/package.json +3 -3
- package/src/components/CardField.tsx +4 -1
- package/src/components/CardForm.tsx +4 -2
- package/src/types/Common.ts +12 -0
- package/src/types/CustomerSheet.ts +4 -0
- package/src/types/PaymentSheet.ts +8 -1
- package/src/types/index.ts +1 -0
- package/stripe-react-native.podspec +1 -1
- package/android/src/main/res/layout/stripe_react_native_google_pay_button.xml +0 -14
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.36.0 - 2024-02-02
|
|
6
|
+
|
|
7
|
+
**Features**
|
|
8
|
+
|
|
9
|
+
- Use `preferredNetworks` on `CardField`, `CardForm`, `CustomerSheet`, and `PaymentSheet` to set the list of preferred networks that should be used to process payments made with a co-branded card.
|
|
10
|
+
- Set the Google Pay button type that is used in PaymentSheet with the `googlePay.buttonType` parameter.
|
|
11
|
+
|
|
12
|
+
**Fixes**
|
|
13
|
+
|
|
14
|
+
- Fixed an issue on Android where `CardField`'s `placeholderColor` wasn't being applied to the card brand icon.
|
|
15
|
+
|
|
16
|
+
## 0.35.1 - 2024-01-16
|
|
17
|
+
|
|
18
|
+
**Fixes**
|
|
19
|
+
|
|
20
|
+
- Fixed a build error on Android when using React Native 0.73.0 and higher [#1579](https://github.com/stripe/stripe-react-native/pull/1579)
|
|
21
|
+
- Fixed the test mock for `useStripe` [#1559](https://github.com/stripe/stripe-react-native/pull/1559)
|
|
22
|
+
- Fixed a build error on Android that would only occur when using the `nx` build tool [#1586](https://github.com/stripe/stripe-react-native/pull/1586)
|
|
23
|
+
|
|
5
24
|
## 0.35.0 - 2023-11-02
|
|
6
25
|
|
|
7
26
|
**Features**
|
|
@@ -100,7 +119,7 @@
|
|
|
100
119
|
|
|
101
120
|
- Fixes `handleURLCallback` to only take action on iOS, no-op on Android. [#1423](https://github.com/stripe/stripe-react-native/pull/1423)
|
|
102
121
|
|
|
103
|
-
## 0.28.0 - 2023-06-16
|
|
122
|
+
## 0.28.0 - 2023-06-16 (📌 Expo SDK 49)
|
|
104
123
|
|
|
105
124
|
**Features**
|
|
106
125
|
|
package/README.md
CHANGED
|
@@ -242,6 +242,10 @@ See the [contributor guidelines](CONTRIBUTING.md) to learn how to contribute to
|
|
|
242
242
|
|
|
243
243
|
## Troubleshooting
|
|
244
244
|
|
|
245
|
+
### Android web browser windows close on backgrounding the app
|
|
246
|
+
|
|
247
|
+
This is known limitation of using `singleTask` as your `launchMode` on Android. See [here](https://github.com/stripe/stripe-react-native/blob/master/docs/android-chrome-tab-closes-on-background.md) for a workaround.
|
|
248
|
+
|
|
245
249
|
### `Undefined symbols for architecture x86_64` on iOS
|
|
246
250
|
|
|
247
251
|
While building your iOS project, you may see a `Undefined symbols for architecture x86_64` error. This is caused by `react-native init` template configuration that is not fully compatible with Swift 5.1.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
package com.reactnativestripesdk
|
|
2
2
|
|
|
3
|
+
import android.annotation.SuppressLint
|
|
3
4
|
import android.content.res.ColorStateList
|
|
4
5
|
import android.graphics.Color
|
|
5
6
|
import android.os.Build
|
|
@@ -166,10 +167,11 @@ class CardFieldView(context: ThemedReactContext) : FrameLayout(context) {
|
|
|
166
167
|
|
|
167
168
|
private fun setCardBrandTint(color: Int) {
|
|
168
169
|
try {
|
|
169
|
-
cardInputWidgetBinding.cardBrandView::class.java
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
cardInputWidgetBinding.cardBrandView::class.java
|
|
171
|
+
.getDeclaredMethod("setTintColorInt\$payments_core_release", Int::class.java)
|
|
172
|
+
.let {
|
|
173
|
+
it(cardInputWidgetBinding.cardBrandView, color)
|
|
174
|
+
}
|
|
173
175
|
} catch (e: Exception) {
|
|
174
176
|
Log.e(
|
|
175
177
|
"StripeReactNative",
|
|
@@ -204,7 +206,7 @@ class CardFieldView(context: ThemedReactContext) : FrameLayout(context) {
|
|
|
204
206
|
fun setPostalCodeEnabled(isEnabled: Boolean) {
|
|
205
207
|
mCardWidget.postalCodeEnabled = isEnabled
|
|
206
208
|
|
|
207
|
-
if (isEnabled
|
|
209
|
+
if (isEnabled == false) {
|
|
208
210
|
mCardWidget.postalCodeRequired = false
|
|
209
211
|
}
|
|
210
212
|
}
|
|
@@ -213,10 +215,15 @@ class CardFieldView(context: ThemedReactContext) : FrameLayout(context) {
|
|
|
213
215
|
mCardWidget.isEnabled = !isDisabled
|
|
214
216
|
}
|
|
215
217
|
|
|
218
|
+
fun setPreferredNetworks(preferredNetworks: ArrayList<Int>?) {
|
|
219
|
+
mCardWidget.setPreferredNetworks(mapToPreferredNetworks(preferredNetworks))
|
|
220
|
+
}
|
|
221
|
+
|
|
216
222
|
/**
|
|
217
223
|
* We can reliable assume that setPostalCodeEnabled is called before
|
|
218
224
|
* setCountryCode because of the order of the props in CardField.tsx
|
|
219
225
|
*/
|
|
226
|
+
@SuppressLint("RestrictedApi")
|
|
220
227
|
fun setCountryCode(countryString: String?) {
|
|
221
228
|
if (mCardWidget.postalCodeEnabled) {
|
|
222
229
|
val countryCode = CountryCode.create(value = countryString ?: LocaleListCompat.getAdjustedDefault()[0]?.country ?: "US")
|
|
@@ -354,6 +361,7 @@ class CardFieldView(context: ThemedReactContext) : FrameLayout(context) {
|
|
|
354
361
|
)
|
|
355
362
|
}
|
|
356
363
|
|
|
364
|
+
@SuppressLint("RestrictedApi")
|
|
357
365
|
private fun createPostalCodeInputFilter(countryCode: CountryCode): InputFilter {
|
|
358
366
|
return InputFilter { charSequence, start, end, _, _, _ ->
|
|
359
367
|
for (i in start until end) {
|
|
@@ -61,6 +61,12 @@ class CardFieldViewManager : SimpleViewManager<CardFieldView>() {
|
|
|
61
61
|
view.setDisabled(isDisabled)
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
@ReactProp(name = "preferredNetworks")
|
|
65
|
+
fun setPreferredNetworks(view: CardFieldView, preferredNetworks: ReadableArray?) {
|
|
66
|
+
val networks = preferredNetworks?.toArrayList()?.filterIsInstance<Int>()?.let { ArrayList(it) }
|
|
67
|
+
view.setPreferredNetworks(networks)
|
|
68
|
+
}
|
|
69
|
+
|
|
64
70
|
override fun createViewInstance(reactContext: ThemedReactContext): CardFieldView {
|
|
65
71
|
val stripeSdkModule: StripeSdkModule? = reactContext.getNativeModule(StripeSdkModule::class.java)
|
|
66
72
|
val view = CardFieldView(reactContext)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
package com.reactnativestripesdk
|
|
2
2
|
|
|
3
|
+
import android.annotation.SuppressLint
|
|
3
4
|
import android.content.res.ColorStateList
|
|
4
5
|
import android.graphics.Color
|
|
5
6
|
import android.os.Build
|
|
@@ -28,7 +29,7 @@ import com.stripe.android.view.CardFormView
|
|
|
28
29
|
import com.stripe.android.view.CardInputListener
|
|
29
30
|
|
|
30
31
|
class CardFormView(context: ThemedReactContext) : FrameLayout(context) {
|
|
31
|
-
private var cardForm: CardFormView = CardFormView(context, null, R.style.StripeCardFormView_Borderless)
|
|
32
|
+
private var cardForm: CardFormView = CardFormView(context, null, com.stripe.android.R.style.StripeCardFormView_Borderless)
|
|
32
33
|
private var mEventDispatcher: EventDispatcher? = context.getNativeModule(UIManagerModule::class.java)?.eventDispatcher
|
|
33
34
|
private var dangerouslyGetFullCardDetails: Boolean = false
|
|
34
35
|
private var currentFocusedField: String? = null
|
|
@@ -62,6 +63,11 @@ class CardFormView(context: ThemedReactContext) : FrameLayout(context) {
|
|
|
62
63
|
cardForm.isEnabled = !isDisabled
|
|
63
64
|
}
|
|
64
65
|
|
|
66
|
+
fun setPreferredNetworks(preferredNetworks: ArrayList<Int>?) {
|
|
67
|
+
cardForm.setPreferredNetworks(mapToPreferredNetworks(preferredNetworks))
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@SuppressLint("RestrictedApi")
|
|
65
71
|
private fun setCountry(countryString: String?) {
|
|
66
72
|
if (countryString != null) {
|
|
67
73
|
cardFormViewBinding.countryLayout.setSelectedCountryCode(CountryCode(countryString))
|
|
@@ -122,6 +128,7 @@ class CardFormView(context: ThemedReactContext) : FrameLayout(context) {
|
|
|
122
128
|
CardFocusEvent(id, currentFocusedField))
|
|
123
129
|
}
|
|
124
130
|
|
|
131
|
+
@SuppressLint("RestrictedApi")
|
|
125
132
|
fun setCardStyle(value: ReadableMap) {
|
|
126
133
|
val backgroundColor = getValOr(value, "backgroundColor", null)
|
|
127
134
|
val textColor = getValOr(value, "textColor", null)
|
|
@@ -287,6 +294,7 @@ class CardFormView(context: ThemedReactContext) : FrameLayout(context) {
|
|
|
287
294
|
)
|
|
288
295
|
}
|
|
289
296
|
|
|
297
|
+
@SuppressLint("RestrictedApi")
|
|
290
298
|
private fun createPostalCodeInputFilter(): InputFilter {
|
|
291
299
|
return InputFilter { charSequence, start, end, _, _, _ ->
|
|
292
300
|
if (cardFormViewBinding.countryLayout.getSelectedCountryCode() == CountryCode.US) {
|
|
@@ -61,6 +61,12 @@ class CardFormViewManager : SimpleViewManager<CardFormView>() {
|
|
|
61
61
|
view.setDisabled(isDisabled)
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
@ReactProp(name = "preferredNetworks")
|
|
65
|
+
fun setPreferredNetworks(view: CardFormView, preferredNetworks: ReadableArray?) {
|
|
66
|
+
val networks = preferredNetworks?.toArrayList()?.filterIsInstance<Int>()?.let { ArrayList(it) }
|
|
67
|
+
view.setPreferredNetworks(networks)
|
|
68
|
+
}
|
|
69
|
+
|
|
64
70
|
override fun createViewInstance(reactContext: ThemedReactContext): CardFormView {
|
|
65
71
|
val stripeSdkModule: StripeSdkModule? = reactContext.getNativeModule(StripeSdkModule::class.java)
|
|
66
72
|
val view = CardFormView(reactContext)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
package com.reactnativestripesdk
|
|
2
2
|
|
|
3
|
+
import android.annotation.SuppressLint
|
|
3
4
|
import android.util.Log
|
|
4
5
|
import android.view.View
|
|
5
6
|
import android.widget.FrameLayout
|
|
@@ -41,6 +42,7 @@ class GooglePayButtonView(private val context: ThemedReactContext) : FrameLayout
|
|
|
41
42
|
return googlePayButton
|
|
42
43
|
}
|
|
43
44
|
|
|
45
|
+
@SuppressLint("RestrictedApi")
|
|
44
46
|
private fun buildButtonOptions(): ButtonOptions {
|
|
45
47
|
val allowedPaymentMethods = JSONArray().put(
|
|
46
48
|
GooglePayJsonFactory(context).createCardPaymentMethod(
|
|
@@ -194,7 +194,8 @@ class PaymentSheetFragment(
|
|
|
194
194
|
appearance = appearance,
|
|
195
195
|
shippingDetails = shippingDetails,
|
|
196
196
|
primaryButtonLabel = primaryButtonLabel,
|
|
197
|
-
billingDetailsCollectionConfiguration = billingDetailsConfig
|
|
197
|
+
billingDetailsCollectionConfiguration = billingDetailsConfig,
|
|
198
|
+
preferredNetworks = mapToPreferredNetworks(arguments?.getIntegerArrayList("preferredNetworks"))
|
|
198
199
|
)
|
|
199
200
|
|
|
200
201
|
if (arguments?.getBoolean("customFlow") == true) {
|
|
@@ -342,6 +343,17 @@ class PaymentSheetFragment(
|
|
|
342
343
|
companion object {
|
|
343
344
|
internal const val TAG = "payment_sheet_launch_fragment"
|
|
344
345
|
|
|
346
|
+
private val mapIntToButtonType = mapOf(
|
|
347
|
+
1 to PaymentSheet.GooglePayConfiguration.ButtonType.Buy,
|
|
348
|
+
6 to PaymentSheet.GooglePayConfiguration.ButtonType.Book,
|
|
349
|
+
5 to PaymentSheet.GooglePayConfiguration.ButtonType.Checkout,
|
|
350
|
+
4 to PaymentSheet.GooglePayConfiguration.ButtonType.Donate,
|
|
351
|
+
11 to PaymentSheet.GooglePayConfiguration.ButtonType.Order,
|
|
352
|
+
1000 to PaymentSheet.GooglePayConfiguration.ButtonType.Pay,
|
|
353
|
+
7 to PaymentSheet.GooglePayConfiguration.ButtonType.Subscribe,
|
|
354
|
+
1001 to PaymentSheet.GooglePayConfiguration.ButtonType.Plain,
|
|
355
|
+
)
|
|
356
|
+
|
|
345
357
|
internal fun createMissingInitError(): WritableMap {
|
|
346
358
|
return createError(PaymentSheetErrorType.Failed.toString(), "No payment sheet has been initialized yet. You must call `initPaymentSheet` before `presentPaymentSheet`.")
|
|
347
359
|
}
|
|
@@ -356,13 +368,16 @@ class PaymentSheetFragment(
|
|
|
356
368
|
val testEnv = params.getBoolean("testEnv")
|
|
357
369
|
val amount = params.getString("amount")?.toLongOrNull()
|
|
358
370
|
val label = params.getString("label")
|
|
371
|
+
val buttonType = mapIntToButtonType.get(params.getInt("buttonType")) ?: PaymentSheet.GooglePayConfiguration.ButtonType.Pay
|
|
372
|
+
|
|
359
373
|
|
|
360
374
|
return PaymentSheet.GooglePayConfiguration(
|
|
361
375
|
environment = if (testEnv) PaymentSheet.GooglePayConfiguration.Environment.Test else PaymentSheet.GooglePayConfiguration.Environment.Production,
|
|
362
376
|
countryCode = countryCode,
|
|
363
377
|
currencyCode = currencyCode,
|
|
364
378
|
amount = amount,
|
|
365
|
-
label = label
|
|
379
|
+
label = label,
|
|
380
|
+
buttonType = buttonType
|
|
366
381
|
)
|
|
367
382
|
}
|
|
368
383
|
|
package/android/src/main/java/com/reactnativestripesdk/customersheet/CustomerSheetFragment.kt
CHANGED
|
@@ -84,11 +84,11 @@ class CustomerSheetFragment : Fragment() {
|
|
|
84
84
|
return
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
val configuration = CustomerSheet.Configuration.builder()
|
|
87
|
+
val configuration = CustomerSheet.Configuration.builder(merchantDisplayName ?: "")
|
|
88
88
|
.appearance(appearance)
|
|
89
89
|
.googlePayEnabled(googlePayEnabled)
|
|
90
|
-
.merchantDisplayName(merchantDisplayName)
|
|
91
90
|
.headerTextForSelectionScreen(headerTextForSelectionScreen)
|
|
91
|
+
.preferredNetworks(mapToPreferredNetworks(arguments?.getIntegerArrayList("preferredNetworks")))
|
|
92
92
|
|
|
93
93
|
billingDetailsBundle?.let {
|
|
94
94
|
configuration.defaultBillingDetails(createDefaultBillingDetails(billingDetailsBundle))
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
package com.reactnativestripesdk.utils
|
|
2
2
|
|
|
3
|
+
import android.annotation.SuppressLint
|
|
3
4
|
import android.os.Bundle
|
|
4
5
|
import android.util.Log
|
|
5
6
|
import com.facebook.react.bridge.*
|
|
@@ -447,6 +448,7 @@ internal fun mapFromPaymentIntentResult(paymentIntent: PaymentIntent): WritableM
|
|
|
447
448
|
return map
|
|
448
449
|
}
|
|
449
450
|
|
|
451
|
+
@SuppressLint("RestrictedApi")
|
|
450
452
|
internal fun mapFromMicrodepositType(type: MicrodepositType): String {
|
|
451
453
|
return when (type) {
|
|
452
454
|
MicrodepositType.AMOUNTS -> "amounts"
|
|
@@ -455,6 +457,7 @@ internal fun mapFromMicrodepositType(type: MicrodepositType): String {
|
|
|
455
457
|
}
|
|
456
458
|
}
|
|
457
459
|
|
|
460
|
+
@SuppressLint("RestrictedApi")
|
|
458
461
|
internal fun mapNextAction(type: NextActionType?, data: NextActionData?): WritableNativeMap? {
|
|
459
462
|
val nextActionMap = WritableNativeMap()
|
|
460
463
|
when (type) {
|
|
@@ -909,7 +912,7 @@ internal fun mapFromShippingContact(googlePayResult: GooglePayResult): WritableM
|
|
|
909
912
|
googlePayResult.shippingInformation?.phone?.let {
|
|
910
913
|
map.putString("phoneNumber", it)
|
|
911
914
|
} ?: run {
|
|
912
|
-
map.putString("phoneNumber", googlePayResult
|
|
915
|
+
map.putString("phoneNumber", googlePayResult.phoneNumber)
|
|
913
916
|
}
|
|
914
917
|
val postalAddress = WritableNativeMap()
|
|
915
918
|
postalAddress.putString("city", googlePayResult.shippingInformation?.address?.city)
|
|
@@ -926,3 +929,25 @@ internal fun mapFromShippingContact(googlePayResult: GooglePayResult): WritableM
|
|
|
926
929
|
map.putMap("postalAddress", postalAddress)
|
|
927
930
|
return map
|
|
928
931
|
}
|
|
932
|
+
|
|
933
|
+
internal fun mapToPreferredNetworks(networksAsInts: ArrayList<Int>?): List<CardBrand> {
|
|
934
|
+
if (networksAsInts == null) {
|
|
935
|
+
return emptyList()
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
val intToCardBrand = mapOf(
|
|
939
|
+
0 to CardBrand.JCB,
|
|
940
|
+
1 to CardBrand.AmericanExpress,
|
|
941
|
+
2 to CardBrand.CartesBancaires,
|
|
942
|
+
3 to CardBrand.DinersClub,
|
|
943
|
+
4 to CardBrand.Discover,
|
|
944
|
+
5 to CardBrand.MasterCard,
|
|
945
|
+
6 to CardBrand.UnionPay,
|
|
946
|
+
7 to CardBrand.Visa,
|
|
947
|
+
8 to CardBrand.Unknown,
|
|
948
|
+
)
|
|
949
|
+
|
|
950
|
+
return networksAsInts.mapNotNull {
|
|
951
|
+
intToCardBrand[it]
|
|
952
|
+
}
|
|
953
|
+
}
|
package/ios/CardFieldManager.m
CHANGED
|
@@ -12,6 +12,7 @@ RCT_EXPORT_VIEW_PROPERTY(placeholders, NSDictionary)
|
|
|
12
12
|
RCT_EXPORT_VIEW_PROPERTY(autofocus, BOOL)
|
|
13
13
|
RCT_EXPORT_VIEW_PROPERTY(disabled, BOOL)
|
|
14
14
|
RCT_EXPORT_VIEW_PROPERTY(dangerouslyGetFullCardDetails, BOOL)
|
|
15
|
+
RCT_EXPORT_VIEW_PROPERTY(preferredNetworks, NSArray)
|
|
15
16
|
RCT_EXTERN_METHOD(focus:(nonnull NSNumber*) reactTag)
|
|
16
17
|
RCT_EXTERN_METHOD(blur:(nonnull NSNumber*) reactTag)
|
|
17
18
|
RCT_EXTERN_METHOD(clear:(nonnull NSNumber*) reactTag)
|
package/ios/CardFieldView.swift
CHANGED
|
@@ -30,6 +30,14 @@ class CardFieldView: UIView, STPPaymentCardTextFieldDelegate {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
@objc var preferredNetworks: Array<Int>? {
|
|
34
|
+
didSet {
|
|
35
|
+
if let preferredNetworks = preferredNetworks {
|
|
36
|
+
cardField.preferredNetworks = preferredNetworks.map(Mappers.intToCardBrand).compactMap { $0 }
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
33
41
|
@objc var placeholders: NSDictionary = NSDictionary() {
|
|
34
42
|
didSet {
|
|
35
43
|
if let numberPlaceholder = placeholders["number"] as? String {
|
package/ios/CardFormManager.m
CHANGED
|
@@ -8,6 +8,7 @@ RCT_EXPORT_VIEW_PROPERTY(dangerouslyGetFullCardDetails, BOOL)
|
|
|
8
8
|
RCT_EXPORT_VIEW_PROPERTY(autofocus, BOOL)
|
|
9
9
|
RCT_EXPORT_VIEW_PROPERTY(cardStyle, NSDictionary)
|
|
10
10
|
RCT_EXPORT_VIEW_PROPERTY(disabled, BOOL)
|
|
11
|
+
RCT_EXPORT_VIEW_PROPERTY(preferredNetworks, NSArray)
|
|
11
12
|
RCT_EXTERN_METHOD(focus:(nonnull NSNumber*) reactTag)
|
|
12
13
|
RCT_EXTERN_METHOD(blur:(nonnull NSNumber*) reactTag)
|
|
13
14
|
@end
|
package/ios/CardFormView.swift
CHANGED
|
@@ -11,6 +11,13 @@ class CardFormView: UIView, STPCardFormViewDelegate {
|
|
|
11
11
|
@objc var onFormComplete: RCTDirectEventBlock?
|
|
12
12
|
@objc var autofocus: Bool = false
|
|
13
13
|
@objc var disabled: Bool = false
|
|
14
|
+
@objc var preferredNetworks: Array<Int>? {
|
|
15
|
+
didSet {
|
|
16
|
+
if let preferredNetworks = preferredNetworks {
|
|
17
|
+
cardForm?.preferredNetworks = preferredNetworks.map(Mappers.intToCardBrand).compactMap { $0 }
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
14
21
|
|
|
15
22
|
override func didSetProps(_ changedProps: [String]!) {
|
|
16
23
|
if let cardForm = self.cardForm {
|
|
@@ -18,7 +18,8 @@ class CustomerSheetUtils {
|
|
|
18
18
|
applePayEnabled: Bool?,
|
|
19
19
|
merchantDisplayName: String?,
|
|
20
20
|
billingDetailsCollectionConfiguration: NSDictionary?,
|
|
21
|
-
defaultBillingDetails: NSDictionary
|
|
21
|
+
defaultBillingDetails: NSDictionary?,
|
|
22
|
+
preferredNetworks: Array<Int>?
|
|
22
23
|
) -> CustomerSheet.Configuration {
|
|
23
24
|
var config = CustomerSheet.Configuration()
|
|
24
25
|
config.appearance = appearance
|
|
@@ -30,6 +31,9 @@ class CustomerSheetUtils {
|
|
|
30
31
|
if let merchantDisplayName = merchantDisplayName {
|
|
31
32
|
config.merchantDisplayName = merchantDisplayName
|
|
32
33
|
}
|
|
34
|
+
if let preferredNetworks = preferredNetworks {
|
|
35
|
+
config.preferredNetworks = preferredNetworks.map(Mappers.intToCardBrand).compactMap { $0 }
|
|
36
|
+
}
|
|
33
37
|
if let billingConfigParams = billingDetailsCollectionConfiguration {
|
|
34
38
|
config.billingDetailsCollectionConfiguration.name = StripeSdk.mapToCollectionMode(str: billingConfigParams["name"] as? String)
|
|
35
39
|
config.billingDetailsCollectionConfiguration.phone = StripeSdk.mapToCollectionMode(str: billingConfigParams["phone"] as? String)
|
package/ios/Mappers.swift
CHANGED
|
@@ -1025,4 +1025,29 @@ class Mappers {
|
|
|
1025
1025
|
default: return STPPaymentMethodUSBankAccountType.checking
|
|
1026
1026
|
}
|
|
1027
1027
|
}
|
|
1028
|
+
|
|
1029
|
+
class func intToCardBrand(int: Int) -> STPCardBrand? {
|
|
1030
|
+
switch int {
|
|
1031
|
+
case 0:
|
|
1032
|
+
return STPCardBrand.JCB
|
|
1033
|
+
case 1:
|
|
1034
|
+
return STPCardBrand.amex
|
|
1035
|
+
case 2:
|
|
1036
|
+
return STPCardBrand.cartesBancaires
|
|
1037
|
+
case 3:
|
|
1038
|
+
return STPCardBrand.dinersClub
|
|
1039
|
+
case 4:
|
|
1040
|
+
return STPCardBrand.discover
|
|
1041
|
+
case 5:
|
|
1042
|
+
return STPCardBrand.mastercard
|
|
1043
|
+
case 6:
|
|
1044
|
+
return STPCardBrand.unionPay
|
|
1045
|
+
case 7:
|
|
1046
|
+
return STPCardBrand.visa
|
|
1047
|
+
case 8:
|
|
1048
|
+
return STPCardBrand.unknown
|
|
1049
|
+
default:
|
|
1050
|
+
return nil
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1028
1053
|
}
|
|
@@ -22,7 +22,9 @@ extension StripeSdk {
|
|
|
22
22
|
applePayEnabled: params["applePayEnabled"] as? Bool,
|
|
23
23
|
merchantDisplayName: params["merchantDisplayName"] as? String,
|
|
24
24
|
billingDetailsCollectionConfiguration: params["billingDetailsCollectionConfiguration"] as? NSDictionary,
|
|
25
|
-
defaultBillingDetails: params["defaultBillingDetails"] as? NSDictionary
|
|
25
|
+
defaultBillingDetails: params["defaultBillingDetails"] as? NSDictionary,
|
|
26
|
+
preferredNetworks: params["preferredNetworks"] as? Array<Int>
|
|
27
|
+
)
|
|
26
28
|
} catch {
|
|
27
29
|
resolve(
|
|
28
30
|
Errors.createError(ErrorType.Failed, error.localizedDescription)
|
|
@@ -99,6 +99,10 @@ extension StripeSdk {
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
if let preferredNetworksAsInts = params["preferredNetworks"] as? Array<Int> {
|
|
103
|
+
configuration.preferredNetworks = preferredNetworksAsInts.map(Mappers.intToCardBrand).compactMap { $0 }
|
|
104
|
+
}
|
|
105
|
+
|
|
102
106
|
return (nil, configuration)
|
|
103
107
|
}
|
|
104
108
|
|
package/jest/mock.js
CHANGED
|
@@ -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:
|
|
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:182,columnNumber:7}}));});exports.CardField=CardField;
|
|
2
2
|
//# sourceMappingURL=CardField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CardFieldNative","requireNativeComponent","CardField","forwardRef","ref","onCardChange","onFocus","onBlur","cardStyle","placeholders","postalCodeEnabled","countryCode","props","inputRef","useRef","onCardChangeHandler","useCallback","event","card","nativeEvent","data","last4","expiryMonth","expiryYear","complete","brand","validExpiryDate","validNumber","validCVC","hasOwnProperty","postalCode","number","cvc","__DEV__","console","warn","onFocusHandler","focusedField","focusInput","current","focus","UIManager","dispatchViewManagerCommand","findNodeHandle","blur","clear","useImperativeHandle","useLayoutEffect","inputRefValue","registerInput","unregisterInput","currentlyFocusedInput","backgroundColor","borderColor","borderWidth","borderRadius","cursorColor","fontSize","placeholderColor","textColor","textErrorColor","fontFamily","expiration"],"sources":["CardField.tsx"],"sourcesContent":["import type { CardFieldInput } from '../types';\nimport React, {\n forwardRef,\n useCallback,\n useImperativeHandle,\n useLayoutEffect,\n useRef,\n} from 'react';\nimport {\n AccessibilityProps,\n NativeSyntheticEvent,\n requireNativeComponent,\n UIManager,\n StyleProp,\n findNodeHandle,\n ViewStyle,\n} from 'react-native';\nimport {\n currentlyFocusedInput,\n focusInput,\n registerInput,\n unregisterInput,\n} from '../helpers';\n\nconst CardFieldNative =\n requireNativeComponent<CardFieldInput.NativeProps>('CardField');\n\n/**\n * Card Field Component Props\n */\nexport interface Props extends AccessibilityProps {\n style?: StyleProp<ViewStyle>;\n /** Controls if a postal code entry field can be displayed to the user. If true, the type of code entry shown is controlled by the set countryCode prop. Some country codes may result in no postal code entry being shown if those countries do not commonly use postal codes. If false, no postal code entry will ever be displayed. Defaults to true.*/\n postalCodeEnabled?: boolean;\n /** Controls the postal code entry shown (if the postalCodeEnabled prop is set to true). Defaults to the device's default locale. */\n countryCode?: string;\n /** Applies a disabled state such that user input is not accepted. Defaults to false. */\n disabled?: boolean;\n cardStyle?: CardFieldInput.Styles;\n placeholders?: CardFieldInput.Placeholders;\n autofocus?: boolean;\n onCardChange?(card: CardFieldInput.Details): void;\n onBlur?(): void;\n onFocus?(focusedField: CardFieldInput.FieldName | null): void;\n testID?: string;\n /**\n * WARNING: If set to `true` the full card number will be returned in the `onCardChange` handler.\n * Only do this if you're certain that you fulfill the necessary PCI compliance requirements.\n * Make sure that you're not mistakenly logging or storing full card details!\n * See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance\n */\n dangerouslyGetFullCardDetails?: boolean;\n}\n\n/**\n * Card Field Component\n *\n * @example\n * ```ts\n * <CardField\n * postalCodeEnabled={false}\n * onCardChange={(cardDetails) => {\n * console.log('card details', cardDetails);\n * setCard(cardDetails);\n * }}\n * style={{height: 50}}\n * />\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport const CardField = forwardRef<CardFieldInput.Methods, Props>(\n (\n {\n onCardChange,\n onFocus,\n onBlur,\n cardStyle,\n placeholders,\n postalCodeEnabled,\n countryCode,\n ...props\n },\n ref\n ) => {\n const inputRef = useRef<any>(null);\n\n const onCardChangeHandler = useCallback(\n (event: NativeSyntheticEvent<CardFieldInput.Details>) => {\n const card = event.nativeEvent;\n\n const data: CardFieldInput.Details = {\n last4: card.last4,\n expiryMonth: card.expiryMonth,\n expiryYear: card.expiryYear,\n complete: card.complete,\n brand: card.brand,\n validExpiryDate: card.validExpiryDate,\n validNumber: card.validNumber,\n validCVC: card.validCVC,\n };\n\n if (card.hasOwnProperty('postalCode')) {\n data.postalCode = card.postalCode || '';\n }\n if (card.hasOwnProperty('number') || card.hasOwnProperty('cvc')) {\n data.number = card.number || '';\n data.cvc = card.cvc || '';\n if (__DEV__ && onCardChange && card.complete) {\n console.warn(\n `[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`\n );\n }\n }\n onCardChange?.(data);\n },\n [onCardChange]\n );\n\n const onFocusHandler = useCallback(\n (event) => {\n const { focusedField } = event.nativeEvent;\n if (focusedField) {\n focusInput(inputRef.current);\n onFocus?.(focusedField);\n } else {\n onBlur?.();\n }\n },\n [onFocus, onBlur]\n );\n\n const focus = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(inputRef.current),\n 'focus' as any,\n []\n );\n };\n\n const blur = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(inputRef.current),\n 'blur' as any,\n []\n );\n };\n\n const clear = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(inputRef.current),\n 'clear' as any,\n []\n );\n };\n\n useImperativeHandle(ref, () => ({\n focus,\n blur,\n clear,\n }));\n\n useLayoutEffect(() => {\n const inputRefValue = inputRef.current;\n if (inputRefValue !== null) {\n registerInput(inputRefValue);\n return () => {\n unregisterInput(inputRefValue);\n if (currentlyFocusedInput() === inputRefValue) {\n inputRefValue.blur();\n }\n };\n }\n return () => {};\n }, [inputRef]);\n\n return (\n <CardFieldNative\n ref={inputRef}\n onCardChange={onCardChangeHandler}\n onFocusChange={onFocusHandler}\n postalCodeEnabled={postalCodeEnabled ?? true}\n countryCode={countryCode ?? null}\n cardStyle={{\n backgroundColor: cardStyle?.backgroundColor,\n borderColor: cardStyle?.borderColor,\n borderWidth: cardStyle?.borderWidth,\n borderRadius: cardStyle?.borderRadius,\n cursorColor: cardStyle?.cursorColor,\n fontSize: cardStyle?.fontSize,\n placeholderColor: cardStyle?.placeholderColor,\n textColor: cardStyle?.textColor,\n textErrorColor: cardStyle?.textErrorColor,\n fontFamily: cardStyle?.fontFamily,\n }}\n placeholders={{\n number: placeholders?.number,\n expiration: placeholders?.expiration,\n cvc: placeholders?.cvc,\n postalCode: placeholders?.postalCode,\n }}\n {...props}\n />\n );\n }\n);\n"],"mappings":"qWACA,qDAOA,yCASA,mCAKoB,otCAEpB,GAAMA,gBAAe,CACnB,GAAAC,mCAAsB,EAA6B,WAAW,CAAC,CA+C1D,GAAMC,UAAS,CAAG,GAAAC,iBAAU,EACjC,cAWEC,GAAG,CACA,IAVD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AAE,EACElB,KAAK,gFACT,CAEN,CAAC,CACF,CAAC"}
|
|
1
|
+
{"version":3,"names":["CardFieldNative","requireNativeComponent","CardField","forwardRef","ref","onCardChange","onFocus","onBlur","cardStyle","placeholders","postalCodeEnabled","countryCode","props","inputRef","useRef","onCardChangeHandler","useCallback","event","card","nativeEvent","data","last4","expiryMonth","expiryYear","complete","brand","validExpiryDate","validNumber","validCVC","hasOwnProperty","postalCode","number","cvc","__DEV__","console","warn","onFocusHandler","focusedField","focusInput","current","focus","UIManager","dispatchViewManagerCommand","findNodeHandle","blur","clear","useImperativeHandle","useLayoutEffect","inputRefValue","registerInput","unregisterInput","currentlyFocusedInput","backgroundColor","borderColor","borderWidth","borderRadius","cursorColor","fontSize","placeholderColor","textColor","textErrorColor","fontFamily","expiration"],"sources":["CardField.tsx"],"sourcesContent":["import type { CardFieldInput, CardBrand } from '../types';\nimport React, {\n forwardRef,\n useCallback,\n useImperativeHandle,\n useLayoutEffect,\n useRef,\n} from 'react';\nimport {\n AccessibilityProps,\n NativeSyntheticEvent,\n requireNativeComponent,\n UIManager,\n StyleProp,\n findNodeHandle,\n ViewStyle,\n} from 'react-native';\nimport {\n currentlyFocusedInput,\n focusInput,\n registerInput,\n unregisterInput,\n} from '../helpers';\n\nconst CardFieldNative =\n requireNativeComponent<CardFieldInput.NativeProps>('CardField');\n\n/**\n * Card Field Component Props\n */\nexport interface Props extends AccessibilityProps {\n style?: StyleProp<ViewStyle>;\n /** Controls if a postal code entry field can be displayed to the user. If true, the type of code entry shown is controlled by the set countryCode prop. Some country codes may result in no postal code entry being shown if those countries do not commonly use postal codes. If false, no postal code entry will ever be displayed. Defaults to true.*/\n postalCodeEnabled?: boolean;\n /** Controls the postal code entry shown (if the postalCodeEnabled prop is set to true). Defaults to the device's default locale. */\n countryCode?: string;\n /** Applies a disabled state such that user input is not accepted. Defaults to false. */\n disabled?: boolean;\n cardStyle?: CardFieldInput.Styles;\n placeholders?: CardFieldInput.Placeholders;\n autofocus?: boolean;\n onCardChange?(card: CardFieldInput.Details): void;\n onBlur?(): void;\n onFocus?(focusedField: CardFieldInput.FieldName | null): void;\n testID?: string;\n /** The list of preferred networks that should be used to process payments made with a co-branded card.\n * This value will only be used if your user hasn't selected a network themselves. */\n preferredNetworks?: Array<CardBrand>;\n /**\n * WARNING: If set to `true` the full card number will be returned in the `onCardChange` handler.\n * Only do this if you're certain that you fulfill the necessary PCI compliance requirements.\n * Make sure that you're not mistakenly logging or storing full card details!\n * See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance\n */\n dangerouslyGetFullCardDetails?: boolean;\n}\n\n/**\n * Card Field Component\n *\n * @example\n * ```ts\n * <CardField\n * postalCodeEnabled={false}\n * onCardChange={(cardDetails) => {\n * console.log('card details', cardDetails);\n * setCard(cardDetails);\n * }}\n * style={{height: 50}}\n * />\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport const CardField = forwardRef<CardFieldInput.Methods, Props>(\n (\n {\n onCardChange,\n onFocus,\n onBlur,\n cardStyle,\n placeholders,\n postalCodeEnabled,\n countryCode,\n ...props\n },\n ref\n ) => {\n const inputRef = useRef<any>(null);\n\n const onCardChangeHandler = useCallback(\n (event: NativeSyntheticEvent<CardFieldInput.Details>) => {\n const card = event.nativeEvent;\n\n const data: CardFieldInput.Details = {\n last4: card.last4,\n expiryMonth: card.expiryMonth,\n expiryYear: card.expiryYear,\n complete: card.complete,\n brand: card.brand,\n validExpiryDate: card.validExpiryDate,\n validNumber: card.validNumber,\n validCVC: card.validCVC,\n };\n\n if (card.hasOwnProperty('postalCode')) {\n data.postalCode = card.postalCode || '';\n }\n if (card.hasOwnProperty('number') || card.hasOwnProperty('cvc')) {\n data.number = card.number || '';\n data.cvc = card.cvc || '';\n if (__DEV__ && onCardChange && card.complete) {\n console.warn(\n `[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`\n );\n }\n }\n onCardChange?.(data);\n },\n [onCardChange]\n );\n\n const onFocusHandler = useCallback(\n (event) => {\n const { focusedField } = event.nativeEvent;\n if (focusedField) {\n focusInput(inputRef.current);\n onFocus?.(focusedField);\n } else {\n onBlur?.();\n }\n },\n [onFocus, onBlur]\n );\n\n const focus = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(inputRef.current),\n 'focus' as any,\n []\n );\n };\n\n const blur = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(inputRef.current),\n 'blur' as any,\n []\n );\n };\n\n const clear = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(inputRef.current),\n 'clear' as any,\n []\n );\n };\n\n useImperativeHandle(ref, () => ({\n focus,\n blur,\n clear,\n }));\n\n useLayoutEffect(() => {\n const inputRefValue = inputRef.current;\n if (inputRefValue !== null) {\n registerInput(inputRefValue);\n return () => {\n unregisterInput(inputRefValue);\n if (currentlyFocusedInput() === inputRefValue) {\n inputRefValue.blur();\n }\n };\n }\n return () => {};\n }, [inputRef]);\n\n return (\n <CardFieldNative\n ref={inputRef}\n onCardChange={onCardChangeHandler}\n onFocusChange={onFocusHandler}\n postalCodeEnabled={postalCodeEnabled ?? true}\n countryCode={countryCode ?? null}\n cardStyle={{\n backgroundColor: cardStyle?.backgroundColor,\n borderColor: cardStyle?.borderColor,\n borderWidth: cardStyle?.borderWidth,\n borderRadius: cardStyle?.borderRadius,\n cursorColor: cardStyle?.cursorColor,\n fontSize: cardStyle?.fontSize,\n placeholderColor: cardStyle?.placeholderColor,\n textColor: cardStyle?.textColor,\n textErrorColor: cardStyle?.textErrorColor,\n fontFamily: cardStyle?.fontFamily,\n }}\n placeholders={{\n number: placeholders?.number,\n expiration: placeholders?.expiration,\n cvc: placeholders?.cvc,\n postalCode: placeholders?.postalCode,\n }}\n {...props}\n />\n );\n }\n);\n"],"mapp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5B+B,UAAU,CAAErD,YAAY,cAAZA,YAAY,CAAEqD,UAAU,CACpC9B,GAAG,CAAEvB,YAAY,cAAZA,YAAY,CAAEuB,GAAG,CACtBF,UAAU,CAAErB,YAAY,cAAZA,YAAY,CAAEqB,UAC5B,CAAE,EACElB,KAAK,gFACT,CAEN,CAAC,CACF,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.CardForm=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=["onFormComplete","cardStyle","placeholders","defaultValues"];var _this=this,_jsxFileName="/Users/charliecruzan/stripe/stripe-react-native/src/components/CardForm.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 CardFormNative=(0,_reactNative.requireNativeComponent)('CardForm');var CardForm=(0,_react.forwardRef)(function(_ref,ref){var onFormComplete=_ref.onFormComplete,cardStyle=_ref.cardStyle,placeholders=_ref.placeholders,defaultValues=_ref.defaultValues,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);var inputRef=(0,_react.useRef)(null);var onFormCompleteHandler=(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,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] \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");}}onFormComplete==null?void 0:onFormComplete(data);},[onFormComplete]);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',[]);};(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);}else{}},[]);(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(CardFormNative,(0,_extends2.default)({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},props,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.CardForm=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=["onFormComplete","cardStyle","placeholders","defaultValues"];var _this=this,_jsxFileName="/Users/charliecruzan/stripe/stripe-react-native/src/components/CardForm.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 CardFormNative=(0,_reactNative.requireNativeComponent)('CardForm');var CardForm=(0,_react.forwardRef)(function(_ref,ref){var onFormComplete=_ref.onFormComplete,cardStyle=_ref.cardStyle,placeholders=_ref.placeholders,defaultValues=_ref.defaultValues,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);var inputRef=(0,_react.useRef)(null);var onFormCompleteHandler=(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,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] \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");}}onFormComplete==null?void 0:onFormComplete(data);},[onFormComplete]);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',[]);};(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);}else{}},[]);(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(CardFormNative,(0,_extends2.default)({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},props,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:168,columnNumber:7}}));});exports.CardForm=CardForm;
|
|
2
2
|
//# sourceMappingURL=CardForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CardFormNative","requireNativeComponent","CardForm","forwardRef","ref","onFormComplete","cardStyle","placeholders","defaultValues","props","inputRef","useRef","onFormCompleteHandler","useCallback","event","card","nativeEvent","data","last4","expiryMonth","expiryYear","complete","brand","country","postalCode","hasOwnProperty","number","cvc","__DEV__","console","warn","focus","UIManager","dispatchViewManagerCommand","findNodeHandle","current","blur","useImperativeHandle","onFocusHandler","focusedField","focusInput","useLayoutEffect","inputRefValue","registerInput","unregisterInput","currentlyFocusedInput","backgroundColor","borderColor","borderWidth","borderRadius","cursorColor","fontSize","placeholderColor","textColor","textErrorColor","fontFamily","expiration"],"sources":["CardForm.tsx"],"sourcesContent":["import type { CardFormView } from '../types';\nimport React, {\n forwardRef,\n useCallback,\n useImperativeHandle,\n useLayoutEffect,\n useRef,\n} from 'react';\nimport {\n AccessibilityProps,\n NativeSyntheticEvent,\n requireNativeComponent,\n UIManager,\n StyleProp,\n findNodeHandle,\n ViewStyle,\n} from 'react-native';\nimport {\n currentlyFocusedInput,\n focusInput,\n registerInput,\n unregisterInput,\n} from '../helpers';\n\nconst CardFormNative =\n requireNativeComponent<CardFormView.NativeProps>('CardForm');\n\n/**\n * Card Form Component Props\n */\nexport interface Props extends AccessibilityProps {\n style?: StyleProp<ViewStyle>;\n autofocus?: boolean;\n testID?: string;\n /** Applies a disabled state such that user input is not accepted. Defaults to false. */\n disabled?: boolean;\n /** All styles except backgroundColor, cursorColor, borderColor, and borderRadius are Android only */\n cardStyle?: CardFormView.Styles;\n
|
|
1
|
+
{"version":3,"names":["CardFormNative","requireNativeComponent","CardForm","forwardRef","ref","onFormComplete","cardStyle","placeholders","defaultValues","props","inputRef","useRef","onFormCompleteHandler","useCallback","event","card","nativeEvent","data","last4","expiryMonth","expiryYear","complete","brand","country","postalCode","hasOwnProperty","number","cvc","__DEV__","console","warn","focus","UIManager","dispatchViewManagerCommand","findNodeHandle","current","blur","useImperativeHandle","onFocusHandler","focusedField","focusInput","useLayoutEffect","inputRefValue","registerInput","unregisterInput","currentlyFocusedInput","backgroundColor","borderColor","borderWidth","borderRadius","cursorColor","fontSize","placeholderColor","textColor","textErrorColor","fontFamily","expiration"],"sources":["CardForm.tsx"],"sourcesContent":["import type { CardFormView, CardBrand } from '../types';\nimport React, {\n forwardRef,\n useCallback,\n useImperativeHandle,\n useLayoutEffect,\n useRef,\n} from 'react';\nimport {\n AccessibilityProps,\n NativeSyntheticEvent,\n requireNativeComponent,\n UIManager,\n StyleProp,\n findNodeHandle,\n ViewStyle,\n} from 'react-native';\nimport {\n currentlyFocusedInput,\n focusInput,\n registerInput,\n unregisterInput,\n} from '../helpers';\n\nconst CardFormNative =\n requireNativeComponent<CardFormView.NativeProps>('CardForm');\n\n/**\n * Card Form Component Props\n */\nexport interface Props extends AccessibilityProps {\n style?: StyleProp<ViewStyle>;\n autofocus?: boolean;\n testID?: string;\n /** Applies a disabled state such that user input is not accepted. Defaults to false. */\n disabled?: boolean;\n /** All styles except backgroundColor, cursorColor, borderColor, and borderRadius are Android only */\n cardStyle?: CardFormView.Styles;\n /** The list of preferred networks that should be used to process payments made with a co-branded card.\n * This value will only be used if your user hasn't selected a network themselves. */\n preferredNetworks?: Array<CardBrand>;\n // TODO: will make it public when iOS SDK allows for this\n // postalCodeEnabled?: boolean;\n\n /** Android only */\n placeholders?: CardFormView.Placeholders;\n /** Android only */\n defaultValues?: CardFormView.DefaultValues;\n // onBlur?(): void;\n // onFocus?(focusedField: CardFormView.FieldNames | null): void;\n onFormComplete?(card: CardFormView.Details): void;\n /**\n * WARNING: If set to `true` the full card number will be returned in the `onFormComplete` handler.\n * Only do this if you're certain that you fulfill the necessary PCI compliance requirements.\n * Make sure that you're not mistakenly logging or storing full card details!\n * See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance\n */\n dangerouslyGetFullCardDetails?: boolean;\n}\n\n/**\n * Card Form Component\n *\n * @example\n * ```ts\n * <CardForm\n * onFormComplete={(cardDetails) => {\n * console.log('card details', cardDetails);\n * setCard(cardDetails);\n * }}\n * style={{height: 200}}\n * />\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport const CardForm = forwardRef<CardFormView.Methods, Props>(\n (\n {\n onFormComplete,\n cardStyle,\n // postalCodeEnabled = true,\n // onFocus,\n // onBlur,\n placeholders,\n defaultValues,\n ...props\n },\n ref\n ) => {\n const inputRef = useRef<any>(null);\n\n const onFormCompleteHandler = useCallback(\n (event: NativeSyntheticEvent<CardFormView.Details>) => {\n const card = event.nativeEvent;\n\n const data: CardFormView.Details = {\n last4: card.last4,\n expiryMonth: card.expiryMonth,\n expiryYear: card.expiryYear,\n complete: card.complete,\n brand: card.brand,\n country: card.country,\n postalCode: card.postalCode,\n };\n\n if (card.hasOwnProperty('number') || card.hasOwnProperty('cvc')) {\n data.number = card.number || '';\n data.cvc = card.cvc || '';\n if (__DEV__ && onFormComplete && card.complete) {\n console.warn(\n `[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`\n );\n }\n }\n onFormComplete?.(data);\n },\n [onFormComplete]\n );\n\n const focus = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(inputRef.current),\n 'focus' as any,\n []\n );\n };\n\n const blur = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(inputRef.current),\n 'blur' as any,\n []\n );\n };\n\n useImperativeHandle(ref, () => ({\n focus,\n blur,\n }));\n\n const onFocusHandler = useCallback((event) => {\n const { focusedField } = event.nativeEvent;\n if (focusedField) {\n focusInput(inputRef.current);\n // onFocus?.(focusedField);\n } else {\n // onBlur?.();\n }\n }, []);\n\n useLayoutEffect(() => {\n const inputRefValue = inputRef.current;\n if (inputRefValue !== null) {\n registerInput(inputRefValue);\n return () => {\n unregisterInput(inputRefValue);\n if (currentlyFocusedInput() === inputRefValue) {\n inputRefValue.blur();\n }\n };\n }\n return () => {};\n }, [inputRef]);\n\n return (\n <CardFormNative\n ref={inputRef}\n onFormComplete={onFormCompleteHandler}\n cardStyle={{\n backgroundColor: cardStyle?.backgroundColor,\n borderColor: cardStyle?.borderColor,\n borderWidth: cardStyle?.borderWidth,\n borderRadius: cardStyle?.borderRadius,\n cursorColor: cardStyle?.cursorColor,\n fontSize: cardStyle?.fontSize,\n placeholderColor: cardStyle?.placeholderColor,\n textColor: cardStyle?.textColor,\n textErrorColor: cardStyle?.textErrorColor,\n fontFamily: cardStyle?.fontFamily,\n // disabledBackgroundColor: cardStyle?.disabledBackgroundColor,\n // type: cardStyle?.type,\n }}\n placeholders={{\n number: placeholders?.number,\n expiration: placeholders?.expiration,\n cvc: placeholders?.cvc,\n postalCode: placeholders?.postalCode,\n }}\n defaultValues={{\n ...(defaultValues ?? {}),\n }}\n onFocusChange={onFocusHandler}\n // postalCodeEnabled={postalCodeEnabled}\n {...props}\n />\n );\n }\n);\n"],"mappings":"oWACA,qDAOA,yCASA,mCAKoB,grCAEpB,GAAMA,eAAc,CAClB,GAAAC,mCAAsB,EAA2B,UAAU,CAAC,CAoDvD,GAAMC,SAAQ,CAAG,GAAAC,iBAAU,EAChC,cAWEC,GAAG,CACA,IAVDC,eAAc,MAAdA,cAAc,CACdC,SAAS,MAATA,SAAS,CAITC,YAAY,MAAZA,YAAY,CACZC,aAAa,MAAbA,aAAa,CACVC,KAAK,uDAIV,GAAMC,SAAQ,CAAG,GAAAC,aAAM,EAAM,IAAI,CAAC,CAElC,GAAMC,sBAAqB,CAAG,GAAAC,kBAAW,EACvC,SAACC,KAAiD,CAAK,CACrD,GAAMC,KAAI,CAAGD,KAAK,CAACE,WAAW,CAE9B,GAAMC,KAA0B,CAAG,CACjCC,KAAK,CAAEH,IAAI,CAACG,KAAK,CACjBC,WAAW,CAAEJ,IAAI,CAACI,WAAW,CAC7BC,UAAU,CAAEL,IAAI,CAACK,UAAU,CAC3BC,QAAQ,CAAEN,IAAI,CAACM,QAAQ,CACvBC,KAAK,CAAEP,IAAI,CAACO,KAAK,CACjBC,OAAO,CAAER,IAAI,CAACQ,OAAO,CACrBC,UAAU,CAAET,IAAI,CAACS,UACnB,CAAC,CAED,GAAIT,IAAI,CAACU,cAAc,CAAC,QAAQ,CAAC,EAAIV,IAAI,CAACU,cAAc,CAAC,KAAK,CAAC,CAAE,CAC/DR,IAAI,CAACS,MAAM,CAAGX,IAAI,CAACW,MAAM,EAAI,EAAE,CAC/BT,IAAI,CAACU,GAAG,CAAGZ,IAAI,CAACY,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exports.CardBrand=CardBrand;(function(CardBrand){CardBrand[CardBrand["JCB"]=0]="JCB";CardBrand[CardBrand["Amex"]=1]="Amex";CardBrand[CardBrand["CartesBancaires"]=2]="CartesBancaires";CardBrand[CardBrand["DinersClub"]=3]="DinersClub";CardBrand[CardBrand["Discover"]=4]="Discover";CardBrand[CardBrand["Mastercard"]=5]="Mastercard";CardBrand[CardBrand["UnionPay"]=6]="UnionPay";CardBrand[CardBrand["Visa"]=7]="Visa";CardBrand[CardBrand["Unknown"]=8]="Unknown";})(CardBrand||(exports.CardBrand=CardBrand={}));
|
|
2
2
|
//# sourceMappingURL=Common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["Common.ts"],"sourcesContent":["export interface BillingDetails {\n email?: string;\n phone?: string;\n name?: string;\n address?: Address;\n}\n\nexport interface Address {\n city?: string;\n country?: string;\n line1?: string;\n line2?: string;\n postalCode?: string;\n state?: string;\n}\n\nexport type AddressDetails = {\n /** The customer's full name. */\n name?: string;\n /** The customer's address. */\n address?: Address;\n /** The customer's phone number. */\n phone?: string;\n /** Whether or not the checkbox is initally selected. Defaults to false.\n * Note: The checkbox is displayed below the other fields when additionalFields.checkboxLabel is set.\n * */\n isCheckboxSelected?: boolean;\n};\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":["CardBrand"],"sources":["Common.ts"],"sourcesContent":["export interface BillingDetails {\n email?: string;\n phone?: string;\n name?: string;\n address?: Address;\n}\n\nexport interface Address {\n city?: string;\n country?: string;\n line1?: string;\n line2?: string;\n postalCode?: string;\n state?: string;\n}\n\nexport type AddressDetails = {\n /** The customer's full name. */\n name?: string;\n /** The customer's address. */\n address?: Address;\n /** The customer's phone number. */\n phone?: string;\n /** Whether or not the checkbox is initally selected. Defaults to false.\n * Note: The checkbox is displayed below the other fields when additionalFields.checkboxLabel is set.\n * */\n isCheckboxSelected?: boolean;\n};\n\nexport enum CardBrand {\n JCB = 0,\n Amex = 1,\n CartesBancaires = 2,\n DinersClub = 3,\n Discover = 4,\n Mastercard = 5,\n UnionPay = 6,\n Visa = 7,\n Unknown = 8,\n}\n"],"mappings":"qFA6BYA,UAAS,uCAATA,SAAS,EAATA,SAAS,CAATA,SAAS,iBAATA,SAAS,CAATA,SAAS,mBAATA,SAAS,CAATA,SAAS,yCAATA,SAAS,CAATA,SAAS,+BAATA,SAAS,CAATA,SAAS,2BAATA,SAAS,CAATA,SAAS,+BAATA,SAAS,CAATA,SAAS,2BAATA,SAAS,CAATA,SAAS,mBAATA,SAAS,CAATA,SAAS,4BAATA,SAAS,qBAATA,SAAS"}
|