@stripe/stripe-react-native 0.48.0 → 0.49.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/.env +19 -0
- package/CHANGELOG.md +8 -0
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementView.kt +85 -65
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManager.kt +18 -2
- package/android/src/main/java/com/reactnativestripesdk/PaymentOptionDisplayDataMapper.kt +0 -2
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +57 -3
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +25 -0
- package/ios/PaymentSheetAppearance.swift +22 -1
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/xcuserdata/wooj.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/StripeSdk.xcodeproj/xcuserdata/wooj.xcuserdatad/xcschemes/xcschememanagement.plist +19 -0
- package/ios/StripeSdkImpl+PaymentSheet.swift +43 -5
- package/ios/StripeSdkImpl.swift +5 -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/CustomerSheet.js +1 -1
- package/lib/commonjs/components/CustomerSheet.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/hooks/useStripe.js +1 -1
- package/lib/commonjs/hooks/useStripe.js.map +1 -1
- 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/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/CustomerSheet.js +1 -1
- package/lib/module/components/CustomerSheet.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/hooks/useStripe.js +1 -1
- package/lib/module/hooks/useStripe.js.map +1 -1
- 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/typescript/src/events.d.ts +1 -1
- package/lib/typescript/src/events.d.ts.map +1 -1
- package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts +27 -0
- package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts.map +1 -1
- package/lib/typescript/src/types/PaymentIntent.d.ts +1 -1
- package/lib/typescript/src/types/PaymentIntent.d.ts.map +1 -1
- package/lib/typescript/src/types/PaymentSheet.d.ts +23 -2
- package/lib/typescript/src/types/PaymentSheet.d.ts.map +1 -1
- package/package-lock.json +14114 -0
- package/package.json +1 -1
- package/src/events.ts +1 -0
- package/src/types/EmbeddedPaymentElement.tsx +47 -2
- package/src/types/PaymentIntent.ts +1 -1
- package/src/types/PaymentSheet.ts +27 -1
- package/stripe-react-native.podspec +1 -1
- package/android/.gradle/8.11.1/checksums/checksums.lock +0 -0
- package/android/.gradle/8.11.1/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/8.11.1/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/8.11.1/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/8.11.1/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/8.11.1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.11.1/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/8.11.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.11.1/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/config.properties +0 -2
- package/android/.gradle/file-system.probe +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/caches/deviceStreaming.xml +0 -619
- package/android/.idea/compiler.xml +0 -6
- package/android/.idea/gradle.xml +0 -19
- 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/package.json
CHANGED
package/src/events.ts
CHANGED
|
@@ -34,6 +34,7 @@ type Events =
|
|
|
34
34
|
| 'onCustomerAdapterFetchSelectedPaymentOptionCallback'
|
|
35
35
|
| 'onCustomerAdapterSetupIntentClientSecretForCustomerAttachCallback'
|
|
36
36
|
| 'embeddedPaymentElementFormSheetConfirmComplete'
|
|
37
|
+
| 'embeddedPaymentElementRowSelectionImmediateAction'
|
|
37
38
|
| 'embeddedPaymentElementDidUpdatePaymentOption'
|
|
38
39
|
| 'embeddedPaymentElementDidUpdateHeight'
|
|
39
40
|
| 'embeddedPaymentElementLoadingFailed';
|
|
@@ -92,6 +92,32 @@ export type EmbeddedFormSheetAction =
|
|
|
92
92
|
type: 'continue';
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Describes how you handle row selections in EmbeddedPaymentElement.
|
|
97
|
+
* The embedded view may show payment method options that can be selected without further collecting further details in a form sheet.
|
|
98
|
+
* This type determines what happens upon a user tapping one of these payment options methods:
|
|
99
|
+
* - In the `default` case, the payment method option row enters a selected state.
|
|
100
|
+
* - In the `immediateAction` case, `onSelectPaymentOption` is called.
|
|
101
|
+
*/
|
|
102
|
+
export type EmbeddedRowSelectionBehavior =
|
|
103
|
+
| {
|
|
104
|
+
/**
|
|
105
|
+
* When a payment method option is selected, the customer taps a button to continue or confirm payment.
|
|
106
|
+
* This is the default recommended integration.
|
|
107
|
+
*/
|
|
108
|
+
type: 'default';
|
|
109
|
+
}
|
|
110
|
+
| {
|
|
111
|
+
/**
|
|
112
|
+
* When a payment method option is selected, `onSelectPaymentOption` is triggered.
|
|
113
|
+
* You can implement this function to immediately perform an action such as going back to the checkout screen or confirming the payment.
|
|
114
|
+
* Note that certain payment options like Apple Pay and saved payment methods are disabled in this mode if you set
|
|
115
|
+
* `EmbeddedPaymentElementConfiguration.formSheetAction` to `continue`
|
|
116
|
+
*/
|
|
117
|
+
type: 'immediateAction';
|
|
118
|
+
onSelectPaymentOption?: () => void;
|
|
119
|
+
};
|
|
120
|
+
|
|
95
121
|
/**
|
|
96
122
|
* Configuration object (subset of EmbeddedPaymentElement.Configuration).
|
|
97
123
|
*/
|
|
@@ -166,6 +192,10 @@ export interface EmbeddedPaymentElementConfiguration {
|
|
|
166
192
|
* The sheet has a button at the bottom. `formSheetAction` controls the action the button performs.
|
|
167
193
|
*/
|
|
168
194
|
formSheetAction?: EmbeddedFormSheetAction;
|
|
195
|
+
/** The view can display payment methods that, when tapped, do not open a sheet to collect additional details.
|
|
196
|
+
* `rowSelectionBehavior` controls the behavior tapping on these payment methods performs.
|
|
197
|
+
*/
|
|
198
|
+
rowSelectionBehavior?: EmbeddedRowSelectionBehavior;
|
|
169
199
|
}
|
|
170
200
|
|
|
171
201
|
// -----------------------------------------------------------------------------
|
|
@@ -209,12 +239,13 @@ class EmbeddedPaymentElement {
|
|
|
209
239
|
// -----------------------------------------------------------------------------
|
|
210
240
|
let confirmHandlerCallback: EventSubscription | null = null;
|
|
211
241
|
let formSheetActionConfirmCallback: EventSubscription | null = null;
|
|
242
|
+
let rowSelectionCallback: EventSubscription | null = null;
|
|
212
243
|
|
|
213
244
|
async function createEmbeddedPaymentElement(
|
|
214
245
|
intentConfig: PaymentSheetTypes.IntentConfiguration,
|
|
215
246
|
configuration: EmbeddedPaymentElementConfiguration
|
|
216
247
|
): Promise<EmbeddedPaymentElement> {
|
|
217
|
-
|
|
248
|
+
setupConfirmAndSelectionHandlers(intentConfig, configuration);
|
|
218
249
|
|
|
219
250
|
await NativeStripeSdkModule.createEmbeddedPaymentElement(
|
|
220
251
|
intentConfig,
|
|
@@ -223,7 +254,7 @@ async function createEmbeddedPaymentElement(
|
|
|
223
254
|
return new EmbeddedPaymentElement();
|
|
224
255
|
}
|
|
225
256
|
|
|
226
|
-
function
|
|
257
|
+
function setupConfirmAndSelectionHandlers(
|
|
227
258
|
intentConfig: PaymentSheetTypes.IntentConfiguration,
|
|
228
259
|
configuration: EmbeddedPaymentElementConfiguration
|
|
229
260
|
) {
|
|
@@ -262,6 +293,20 @@ function setupConfirmHandlers(
|
|
|
262
293
|
);
|
|
263
294
|
}
|
|
264
295
|
}
|
|
296
|
+
|
|
297
|
+
if (configuration.rowSelectionBehavior?.type === 'immediateAction') {
|
|
298
|
+
const rowSelectionHandler =
|
|
299
|
+
configuration.rowSelectionBehavior.onSelectPaymentOption;
|
|
300
|
+
if (rowSelectionHandler) {
|
|
301
|
+
rowSelectionCallback?.remove();
|
|
302
|
+
rowSelectionCallback = addListener(
|
|
303
|
+
'embeddedPaymentElementRowSelectionImmediateAction',
|
|
304
|
+
() => {
|
|
305
|
+
rowSelectionHandler();
|
|
306
|
+
}
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
265
310
|
}
|
|
266
311
|
|
|
267
312
|
// -----------------------------------------------------------------------------
|
|
@@ -58,7 +58,7 @@ export type LastPaymentError = StripeError<string> & {
|
|
|
58
58
|
paymentMethod: PaymentMethodResult;
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
export type FutureUsage = 'OffSession' | 'OnSession';
|
|
61
|
+
export type FutureUsage = 'OffSession' | 'OnSession' | 'None';
|
|
62
62
|
|
|
63
63
|
export interface ShippingDetails {
|
|
64
64
|
address: Required<Address>;
|
|
@@ -358,6 +358,10 @@ export enum RowStyle {
|
|
|
358
358
|
FloatingButton = 'floatingButton',
|
|
359
359
|
/** A flat style with a checkmark */
|
|
360
360
|
FlatWithCheckmark = 'flatWithCheckmark',
|
|
361
|
+
/** A flat style with a chevron
|
|
362
|
+
* Note that the EmbeddedPaymentElementConfiguration.rowSelectionBehavior must be set to `immediateAction` to use this style.
|
|
363
|
+
*/
|
|
364
|
+
FlatWithChevron = 'flatWithChevron',
|
|
361
365
|
}
|
|
362
366
|
|
|
363
367
|
/** Describes the appearance of the radio button */
|
|
@@ -381,6 +385,14 @@ export interface CheckmarkConfig {
|
|
|
381
385
|
color?: ThemedColor;
|
|
382
386
|
}
|
|
383
387
|
|
|
388
|
+
/** Describes the appearance of the chevron */
|
|
389
|
+
export interface ChevronConfig {
|
|
390
|
+
/** The color of the chevron, represented as a hex string #AARRGGBB or #RRGGBB.
|
|
391
|
+
* @default The iOS or Android system gray color
|
|
392
|
+
*/
|
|
393
|
+
color?: ThemedColor;
|
|
394
|
+
}
|
|
395
|
+
|
|
384
396
|
/** Describes the appearance of the flat style row */
|
|
385
397
|
export interface FlatConfig {
|
|
386
398
|
/** The thickness of the separator line between rows.
|
|
@@ -395,7 +407,7 @@ export interface FlatConfig {
|
|
|
395
407
|
|
|
396
408
|
/** The insets of the separator line between rows.
|
|
397
409
|
* @default { top: 0, left: 30, bottom: 0, right: 0 } for RowStyle.FlatWithRadio
|
|
398
|
-
* @default { top: 0, left: 0, bottom: 0, right: 0 } for RowStyle.FlatWithCheckmark and RowStyle.FloatingButton
|
|
410
|
+
* @default { top: 0, left: 0, bottom: 0, right: 0 } for RowStyle.FlatWithCheckmark, RowStyle.FlatWithChevron, and RowStyle.FloatingButton
|
|
399
411
|
*/
|
|
400
412
|
separatorInsets?: EdgeInsetsConfig;
|
|
401
413
|
|
|
@@ -414,6 +426,9 @@ export interface FlatConfig {
|
|
|
414
426
|
|
|
415
427
|
/** Appearance settings for the checkmark (used when RowStyle is FlatWithCheckmark) */
|
|
416
428
|
checkmark?: CheckmarkConfig;
|
|
429
|
+
|
|
430
|
+
/** Appearance settings for the chevron (used when RowStyle is FlatWithChevron) */
|
|
431
|
+
chevron?: ChevronConfig;
|
|
417
432
|
}
|
|
418
433
|
|
|
419
434
|
/** Describes the appearance of the floating button style payment method row */
|
|
@@ -562,6 +577,17 @@ export type PaymentMode = {
|
|
|
562
577
|
/* Controls when the funds will be captured.
|
|
563
578
|
Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-capture_method */
|
|
564
579
|
captureMethod?: CaptureMethod;
|
|
580
|
+
/** Additional payment method options params.
|
|
581
|
+
Seealso: https://docs.stripe.com/api/payment_intents/create#create_payment_intent-payment_method_options */
|
|
582
|
+
paymentMethodOptions?: PaymentMethodOptions;
|
|
583
|
+
};
|
|
584
|
+
|
|
585
|
+
export type PaymentMethodOptions = {
|
|
586
|
+
/* This is an experimental feature that may be removed at any time
|
|
587
|
+
A map of payment method types to setup_future_usage value. (e.g. card: 'OffSession') */
|
|
588
|
+
setupFutureUsageValues: {
|
|
589
|
+
[key: string]: FutureUsage;
|
|
590
|
+
};
|
|
565
591
|
};
|
|
566
592
|
|
|
567
593
|
/* Use this if your integration creates a SetupIntent */
|
|
@@ -2,7 +2,7 @@ require 'json'
|
|
|
2
2
|
|
|
3
3
|
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
4
|
# Keep stripe_version in sync with https://github.com/stripe/stripe-identity-react-native/blob/main/stripe-identity-react-native.podspec
|
|
5
|
-
stripe_version = '~> 24.
|
|
5
|
+
stripe_version = '~> 24.16.1'
|
|
6
6
|
|
|
7
7
|
fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
|
|
8
8
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|