@stripe/stripe-react-native 0.27.2 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +2 -2
  3. package/android/gradle.properties +1 -1
  4. package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +4 -0
  5. package/android/src/main/java/com/reactnativestripesdk/CardFieldViewManager.kt +5 -0
  6. package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +4 -0
  7. package/android/src/main/java/com/reactnativestripesdk/CardFormViewManager.kt +5 -0
  8. package/android/src/main/java/com/reactnativestripesdk/FinancialConnectionsSheetFragment.kt +33 -7
  9. package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonManager.kt +0 -5
  10. package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonView.kt +11 -27
  11. package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +131 -6
  12. package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +29 -6
  13. package/android/src/main/java/com/reactnativestripesdk/utils/Errors.kt +2 -0
  14. package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +14 -1
  15. package/ios/ApplePayButtonView.swift +4 -18
  16. package/ios/ApplePayViewController.swift +1 -28
  17. package/ios/CardFieldManager.m +1 -0
  18. package/ios/CardFieldView.swift +6 -0
  19. package/ios/CardFormManager.m +2 -2
  20. package/ios/CardFormView.swift +9 -9
  21. package/ios/StripeSdk+PaymentSheet.swift +100 -10
  22. package/ios/StripeSdk.m +15 -29
  23. package/ios/StripeSdk.swift +32 -91
  24. package/jest/mock.js +0 -6
  25. package/lib/commonjs/NativeStripeSdk.js.map +1 -1
  26. package/lib/commonjs/components/ApplePayButtonNative.js.map +1 -1
  27. package/lib/commonjs/components/CardField.js +1 -1
  28. package/lib/commonjs/components/CardField.js.map +1 -1
  29. package/lib/commonjs/components/CardForm.js +1 -1
  30. package/lib/commonjs/components/CardForm.js.map +1 -1
  31. package/lib/commonjs/components/GooglePayButtonNative.js.map +1 -1
  32. package/lib/commonjs/components/PlatformPayButton.js +1 -1
  33. package/lib/commonjs/components/PlatformPayButton.js.map +1 -1
  34. package/lib/commonjs/functions.js +1 -1
  35. package/lib/commonjs/functions.js.map +1 -1
  36. package/lib/commonjs/hooks/useStripe.js +1 -1
  37. package/lib/commonjs/hooks/useStripe.js.map +1 -1
  38. package/lib/commonjs/index.js +1 -1
  39. package/lib/commonjs/index.js.map +1 -1
  40. package/lib/commonjs/types/ApplePay.js.map +1 -1
  41. package/lib/commonjs/types/PaymentIntent.js.map +1 -1
  42. package/lib/commonjs/types/PaymentSheet.js +1 -1
  43. package/lib/commonjs/types/PaymentSheet.js.map +1 -1
  44. package/lib/commonjs/types/PlatformPay.js.map +1 -1
  45. package/lib/commonjs/types/components/CardFieldInput.js.map +1 -1
  46. package/lib/commonjs/types/components/CardFormView.js.map +1 -1
  47. package/lib/commonjs/types/components/GooglePayButtonComponent.js.map +1 -1
  48. package/lib/commonjs/types/index.js +1 -1
  49. package/lib/commonjs/types/index.js.map +1 -1
  50. package/lib/module/NativeStripeSdk.js.map +1 -1
  51. package/lib/module/components/ApplePayButtonNative.js.map +1 -1
  52. package/lib/module/components/CardField.js +1 -1
  53. package/lib/module/components/CardField.js.map +1 -1
  54. package/lib/module/components/CardForm.js +1 -1
  55. package/lib/module/components/CardForm.js.map +1 -1
  56. package/lib/module/components/GooglePayButtonNative.js.map +1 -1
  57. package/lib/module/components/PlatformPayButton.js +1 -1
  58. package/lib/module/components/PlatformPayButton.js.map +1 -1
  59. package/lib/module/functions.js +1 -1
  60. package/lib/module/functions.js.map +1 -1
  61. package/lib/module/hooks/useStripe.js +1 -1
  62. package/lib/module/hooks/useStripe.js.map +1 -1
  63. package/lib/module/index.js +1 -1
  64. package/lib/module/index.js.map +1 -1
  65. package/lib/module/types/ApplePay.js.map +1 -1
  66. package/lib/module/types/PaymentIntent.js.map +1 -1
  67. package/lib/module/types/PaymentSheet.js +1 -1
  68. package/lib/module/types/PaymentSheet.js.map +1 -1
  69. package/lib/module/types/PlatformPay.js.map +1 -1
  70. package/lib/module/types/components/CardFieldInput.js.map +1 -1
  71. package/lib/module/types/components/CardFormView.js.map +1 -1
  72. package/lib/module/types/components/GooglePayButtonComponent.js.map +1 -1
  73. package/lib/module/types/index.js +1 -1
  74. package/lib/module/types/index.js.map +1 -1
  75. package/lib/typescript/src/NativeStripeSdk.d.ts +4 -15
  76. package/lib/typescript/src/components/ApplePayButtonNative.d.ts +1 -1
  77. package/lib/typescript/src/components/CardField.d.ts +2 -0
  78. package/lib/typescript/src/components/CardForm.d.ts +2 -0
  79. package/lib/typescript/src/components/GooglePayButtonNative.d.ts +1 -1
  80. package/lib/typescript/src/components/PlatformPayButton.d.ts +2 -1
  81. package/lib/typescript/src/functions.d.ts +8 -27
  82. package/lib/typescript/src/hooks/usePlatformPay.d.ts +1 -1
  83. package/lib/typescript/src/hooks/useStripe.d.ts +2 -18
  84. package/lib/typescript/src/index.d.ts +0 -7
  85. package/lib/typescript/src/types/ApplePay.d.ts +0 -52
  86. package/lib/typescript/src/types/PaymentIntent.d.ts +3 -2
  87. package/lib/typescript/src/types/PaymentSheet.d.ts +48 -2
  88. package/lib/typescript/src/types/PlatformPay.d.ts +35 -5
  89. package/lib/typescript/src/types/components/CardFieldInput.d.ts +1 -0
  90. package/lib/typescript/src/types/components/CardFormView.d.ts +1 -0
  91. package/lib/typescript/src/types/components/GooglePayButtonComponent.d.ts +0 -1
  92. package/lib/typescript/src/types/index.d.ts +1 -4
  93. package/package.json +1 -1
  94. package/src/NativeStripeSdk.tsx +6 -31
  95. package/src/components/ApplePayButtonNative.tsx +1 -1
  96. package/src/components/CardField.tsx +2 -0
  97. package/src/components/CardForm.tsx +2 -4
  98. package/src/components/GooglePayButtonNative.tsx +1 -1
  99. package/src/components/PlatformPayButton.tsx +2 -1
  100. package/src/functions.ts +54 -200
  101. package/src/hooks/useStripe.tsx +2 -109
  102. package/src/index.tsx +0 -7
  103. package/src/types/ApplePay.ts +0 -71
  104. package/src/types/PaymentIntent.ts +4 -2
  105. package/src/types/PaymentSheet.ts +86 -2
  106. package/src/types/PlatformPay.ts +36 -5
  107. package/src/types/components/CardFieldInput.ts +1 -0
  108. package/src/types/components/CardFormView.ts +1 -1
  109. package/src/types/components/GooglePayButtonComponent.ts +0 -1
  110. package/src/types/index.ts +0 -6
  111. package/stripe-react-native.podspec +1 -1
  112. package/lib/commonjs/components/ApplePayButton.js +0 -2
  113. package/lib/commonjs/components/ApplePayButton.js.map +0 -1
  114. package/lib/commonjs/components/GooglePayButton.js +0 -2
  115. package/lib/commonjs/components/GooglePayButton.js.map +0 -1
  116. package/lib/commonjs/hooks/useApplePay.js +0 -2
  117. package/lib/commonjs/hooks/useApplePay.js.map +0 -1
  118. package/lib/commonjs/hooks/useGooglePay.js +0 -2
  119. package/lib/commonjs/hooks/useGooglePay.js.map +0 -1
  120. package/lib/commonjs/types/GooglePay.js +0 -2
  121. package/lib/commonjs/types/GooglePay.js.map +0 -1
  122. package/lib/module/components/ApplePayButton.js +0 -2
  123. package/lib/module/components/ApplePayButton.js.map +0 -1
  124. package/lib/module/components/GooglePayButton.js +0 -2
  125. package/lib/module/components/GooglePayButton.js.map +0 -1
  126. package/lib/module/hooks/useApplePay.js +0 -2
  127. package/lib/module/hooks/useApplePay.js.map +0 -1
  128. package/lib/module/hooks/useGooglePay.js +0 -2
  129. package/lib/module/hooks/useGooglePay.js.map +0 -1
  130. package/lib/module/types/GooglePay.js +0 -2
  131. package/lib/module/types/GooglePay.js.map +0 -1
  132. package/lib/typescript/src/components/ApplePayButton.d.ts +0 -31
  133. package/lib/typescript/src/components/GooglePayButton.d.ts +0 -26
  134. package/lib/typescript/src/hooks/useApplePay.d.ts +0 -54
  135. package/lib/typescript/src/hooks/useGooglePay.d.ts +0 -11
  136. package/lib/typescript/src/types/GooglePay.d.ts +0 -47
  137. package/src/components/ApplePayButton.tsx +0 -108
  138. package/src/components/GooglePayButton.tsx +0 -58
  139. package/src/hooks/useApplePay.tsx +0 -161
  140. package/src/hooks/useGooglePay.tsx +0 -72
  141. package/src/types/GooglePay.ts +0 -74
@@ -6,8 +6,11 @@ import type {
6
6
  AutomaticReloadPaymentRequest,
7
7
  MultiMerchantRequest,
8
8
  } from './PlatformPay';
9
+ import type { FutureUsage } from './PaymentIntent';
10
+ import type { Result } from './PaymentMethod';
11
+ import type { StripeError } from './Errors';
9
12
 
10
- export type SetupParams = ClientSecretParams & {
13
+ export type SetupParams = IntentParams & {
11
14
  /** Your customer-facing business name. On Android, this is required and cannot be an empty string. */
12
15
  merchantDisplayName: string;
13
16
  /** The identifier of the Stripe Customer object. See https://stripe.com/docs/api/customers/object#customer_object-id */
@@ -49,14 +52,21 @@ export type SetupParams = ClientSecretParams & {
49
52
  primaryButtonLabel?: string;
50
53
  };
51
54
 
52
- export type ClientSecretParams =
55
+ export type IntentParams =
53
56
  | {
54
57
  paymentIntentClientSecret: string;
55
58
  setupIntentClientSecret?: undefined;
59
+ intentConfiguration?: never;
56
60
  }
57
61
  | {
58
62
  setupIntentClientSecret: string;
59
63
  paymentIntentClientSecret?: undefined;
64
+ intentConfiguration?: never;
65
+ }
66
+ | {
67
+ setupIntentClientSecret?: never;
68
+ paymentIntentClientSecret?: never;
69
+ intentConfiguration: IntentConfiguration;
60
70
  };
61
71
 
62
72
  export type ApplePayParams = {
@@ -295,3 +305,77 @@ export enum AddressCollectionMode {
295
305
  /** Collect the full billing address, regardless of the Payment Method's requirements. */
296
306
  FULL = 'full',
297
307
  }
308
+
309
+ export type IntentCreationError = StripeError<'Failed'>;
310
+
311
+ export type IntentCreationCallbackParams =
312
+ | {
313
+ clientSecret: string;
314
+ error?: never;
315
+ }
316
+ | {
317
+ clientSecret?: never;
318
+ error: IntentCreationError;
319
+ };
320
+
321
+ export type IntentConfiguration = {
322
+ /*
323
+ Called when the customer confirms payment. Your implementation should create a PaymentIntent or SetupIntent on your server and call the `intentCreationCallback` with its client secret or an error if one occurred.
324
+ - Note: You must create the PaymentIntent or SetupIntent with the same values used as the `IntentConfiguration` e.g. the same amount, currency, etc.
325
+ - Parameters:
326
+ - paymentMethod: The PaymentMethod representing the customer's payment details.
327
+ - shouldSavePaymentMethod: This is `true` if the customer selected the "Save this payment method for future use" checkbox. Set `setup_future_usage` on the PaymentIntent to `off_session` if this is `true`.
328
+ - intentCreationCallback: Call this with the `client_secret` of the PaymentIntent or SetupIntent created by your server or the error that occurred. If you're using customFlow: false (default), the error's localizedMessage will be displayed to the customer in the sheet. If you're using customFlow: true, the `confirm` method fails with the error.
329
+ */
330
+ confirmHandler: (
331
+ paymentMethod: Result,
332
+ shouldSavePaymentMethod: boolean,
333
+ intentCreationCallback: (result: IntentCreationCallbackParams) => void
334
+ ) => void;
335
+ /* Information about the payment (PaymentIntent) or setup (SetupIntent).*/
336
+ mode: Mode;
337
+ /* A list of payment method types to display to the customer. If undefined or empty, we dynamically determine the payment methods using your Stripe Dashboard settings. */
338
+ paymentMethodTypes?: Array<string>;
339
+ };
340
+
341
+ export type Mode = PaymentMode | SetupMode;
342
+
343
+ /**
344
+ * Controls when the funds will be captured. Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-capture_method
345
+ */
346
+ export enum CaptureMethod {
347
+ /** (Default) Stripe automatically captures funds when the customer authorizes the payment. */
348
+ Automatic = 'Automatic',
349
+ /** Place a hold on the funds when the customer authorizes the payment, but don’t capture the funds until later. (Not all payment methods support this.) */
350
+ Manual = 'Manual',
351
+ /** Asynchronously capture funds when the customer authorizes the payment.
352
+ - Note: Recommended over `CaptureMethod.Automatic` due to improved latency, but may require additional integration changes.
353
+ - Seealso: https://stripe.com/docs/payments/payment-intents/asynchronous-capture-automatic-async */
354
+ AutomaticAsync = 'AutomaticAsync',
355
+ }
356
+
357
+ /* Use this if your integration creates a PaymentIntent */
358
+ export type PaymentMode = {
359
+ /* Amount intended to be collected in the smallest currency unit (e.g. 100 cents to charge $1.00). Shown in Apple Pay, Google Pay, Buy now pay later UIs, the Pay button, and influences available payment methods.
360
+ Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-amount */
361
+ amount: number;
362
+ /* Three-letter ISO currency code. Filters out payment methods based on supported currency.
363
+ Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-currency */
364
+ currencyCode: string;
365
+ /* Indicates that you intend to make future payments.
366
+ Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage */
367
+ setupFutureUsage?: FutureUsage;
368
+ /* Controls when the funds will be captured.
369
+ Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-capture_method */
370
+ captureMethod?: CaptureMethod;
371
+ };
372
+
373
+ /* Use this if your integration creates a SetupIntent */
374
+ export type SetupMode = {
375
+ /* Three-letter ISO currency code. Filters out payment methods based on supported currency.
376
+ Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-currency */
377
+ currencyCode?: string;
378
+ /* Indicates that you intend to make future payments.
379
+ Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage */
380
+ setupFutureUsage: FutureUsage;
381
+ };
@@ -3,8 +3,6 @@ import type { Result as PaymentMethod } from './PaymentMethod';
3
3
  import type { Result as PaymentIntent } from './PaymentIntent';
4
4
  import type { Result as SetupIntent } from './SetupIntent';
5
5
  import type { StripeError, PlatformPayError } from './Errors';
6
- import type { ShippingContact as ApplePayShippingContact } from './ApplePay';
7
- import type { IsSupportedParams } from './GooglePay';
8
6
 
9
7
  export type ApplePaySheetError =
10
8
  | {
@@ -55,7 +53,7 @@ export type ApplePayBaseParams = {
55
53
  additionalEnabledNetworks?: Array<string>;
56
54
  /** The list of items that describe a purchase. For example: total, tax, discount, and grand total. */
57
55
  cartItems: Array<CartSummaryItem>;
58
- /** The list of fields that you need for a shipping contact in order to process the transaction. If provided, you must implement the PlatformPayButton component's `onShippingContactSelected` callback and call `updatePlatformPaySheet` from there.*/
56
+ /** The list of fields that you need for a shipping contact in order to process the transaction. If you include ContactField.PostalAddress in this array, you must implement the PlatformPayButton component's `onShippingContactSelected` callback and call `updatePlatformPaySheet` from there.*/
59
57
  requiredShippingAddressFields?: Array<ContactField>;
60
58
  /** The list of fields that you need for a billing contact in order to process the transaction. */
61
59
  requiredBillingContactFields?: Array<ContactField>;
@@ -358,11 +356,44 @@ export type ShippingMethod = {
358
356
  endDate?: number;
359
357
  };
360
358
 
359
+ interface PostalAddress {
360
+ city?: string;
361
+ country?: string;
362
+ postalCode?: string;
363
+ state?: string;
364
+ street?: string;
365
+ isoCountryCode?: string;
366
+ subAdministrativeArea?: string;
367
+ subLocality?: string;
368
+ }
369
+
370
+ interface ContactName {
371
+ familyName?: string;
372
+ namePrefix?: string;
373
+ nameSuffix?: string;
374
+ givenName?: string;
375
+ middleName?: string;
376
+ nickname?: string;
377
+ }
378
+
361
379
  /** iOS only. */
362
- export type ShippingContact = ApplePayShippingContact;
380
+ export interface ShippingContact {
381
+ emailAddress?: string;
382
+ name: ContactName;
383
+ phoneNumber?: string;
384
+ postalAddress: PostalAddress;
385
+ }
363
386
 
364
387
  /** Android only. */
365
- export type IsGooglePaySupportedParams = IsSupportedParams;
388
+ export type IsGooglePaySupportedParams = {
389
+ /** Set to true to run in a test environment with relaxed application / merchant requirements. This environment is suggested for early development and for easily testing SDK. Defaults to false. */
390
+ testEnv?: boolean;
391
+ /**
392
+ * If `true`, Google Pay is considered ready if the customer's Google Pay wallet
393
+ * has an existing payment method. Defaults to false.
394
+ */
395
+ existingPaymentMethodRequired?: boolean;
396
+ };
366
397
 
367
398
  export type PaymentMethodResult =
368
399
  | {
@@ -66,6 +66,7 @@ export interface NativeProps {
66
66
  ): void;
67
67
  cardStyle?: Styles;
68
68
  placeholders?: Placeholders;
69
+ disabled?: boolean;
69
70
  }
70
71
 
71
72
  export interface Methods {
@@ -55,7 +55,6 @@ export type DefaultValues = {
55
55
  export interface NativeProps {
56
56
  style?: StyleProp<ViewStyle>;
57
57
  autofocus?: boolean;
58
- // isUserInteractionEnabledValue?: boolean;
59
58
  cardStyle?: Styles;
60
59
  /** Android only */
61
60
  placeholders?: Placeholders;
@@ -66,6 +65,7 @@ export interface NativeProps {
66
65
  event: NativeSyntheticEvent<{ focusedField: FieldName | null }>
67
66
  ): void;
68
67
  onFormComplete(event: NativeSyntheticEvent<Details>): void;
68
+ disabled?: boolean;
69
69
  }
70
70
 
71
71
  export interface Methods {
@@ -2,5 +2,4 @@ import type { StyleProp, ViewStyle } from 'react-native';
2
2
  export interface NativeProps {
3
3
  style?: StyleProp<ViewStyle>;
4
4
  type?: number;
5
- buttonType?: string;
6
5
  }
@@ -19,9 +19,6 @@ import * as PaymentMethod from './PaymentMethod';
19
19
  import * as PaymentSheet from './PaymentSheet';
20
20
  import * as SetupIntent from './SetupIntent';
21
21
  import * as ThreeDSecure from './ThreeDSecure';
22
- import * as GooglePay from './GooglePay';
23
- import * as ApplePayButtonComponent from './components/ApplePayButtonComponent';
24
- import * as GooglePayButtonComponent from './components/GooglePayButtonComponent';
25
22
  import * as AuBECSDebitFormComponent from './components/AuBECSDebitFormComponent';
26
23
  import * as CardFieldInput from './components/CardFieldInput';
27
24
  import * as CardFormView from './components/CardFormView';
@@ -36,9 +33,6 @@ export {
36
33
  PaymentSheet,
37
34
  SetupIntent,
38
35
  ThreeDSecure,
39
- GooglePay,
40
- ApplePayButtonComponent,
41
- GooglePayButtonComponent,
42
36
  AuBECSDebitFormComponent,
43
37
  CardFieldInput,
44
38
  CardFormView,
@@ -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 = '~> 23.8.0'
5
+ stripe_version = '~> 23.10.0'
6
6
 
7
7
  Pod::Spec.new do |s|
8
8
  s.name = 'stripe-react-native'
@@ -1,2 +0,0 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.ApplePayButton=ApplePayButton;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _ApplePayButtonNative=_interopRequireDefault(require("./ApplePayButtonNative"));var _jsxFileName="/Users/charliecruzan/stripe/stripe-react-native/src/components/ApplePayButton.tsx";var _excluded=["onPress","buttonStyle","type","borderRadius"];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;}function ApplePayButton(_ref){var onPress=_ref.onPress,_ref$buttonStyle=_ref.buttonStyle,buttonStyle=_ref$buttonStyle===void 0?'black':_ref$buttonStyle,_ref$type=_ref.type,type=_ref$type===void 0?'plain':_ref$type,_ref$borderRadius=_ref.borderRadius,borderRadius=_ref$borderRadius===void 0?4:_ref$borderRadius,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);var buttonType=(0,_react.useMemo)(function(){return mapButtonType(type);},[type]);var style=(0,_react.useMemo)(function(){return mapButtonStyle(buttonStyle);},[buttonStyle]);return _react.default.createElement(_ApplePayButtonNative.default,(0,_extends2.default)({type:buttonType,buttonStyle:style,borderRadius:borderRadius,onPressAction:onPress},props,{__self:this,__source:{fileName:_jsxFileName,lineNumber:46,columnNumber:5}}));}function mapButtonType(type){switch(type){case'plain':return 0;case'buy':return 1;case'setUp':return 2;case'inStore':return 3;case'donate':return 4;case'checkout':return 5;case'book':return 6;case'subscribe':return 7;case'reload':return 8;case'addMoney':return 9;case'topUp':return 10;case'order':return 11;case'rent':return 12;case'support':return 13;case'contribute':return 14;case'tip':return 15;default:return 0;}}function mapButtonStyle(type){switch(type){case'white':return 0;case'whiteOutline':return 1;case'black':return 2;case'automatic':return 3;default:return 2;}}
2
- //# sourceMappingURL=ApplePayButton.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["ApplePayButton","onPress","buttonStyle","type","borderRadius","props","buttonType","useMemo","mapButtonType","style","mapButtonStyle"],"sources":["ApplePayButton.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport ApplePayButtonNative from './ApplePayButtonNative';\nimport type { AccessibilityProps, StyleProp, ViewStyle } from 'react-native';\nimport type { ApplePayButtonComponent } from '../types';\n\n/**\n * Apple Pay Button Component Props\n */\nexport interface Props extends AccessibilityProps {\n style?: StyleProp<ViewStyle>;\n type?: ApplePayButtonComponent.Type;\n buttonStyle?: ApplePayButtonComponent.Style;\n borderRadius?: number;\n onPress(): void;\n testID?: string;\n}\n\n/**\n * Apple Pay Button Component\n *\n * @example\n * ```ts\n * <ApplePayButton\n * onPress={pay}\n * type=\"plain\"\n * buttonStyle=\"black\"\n * borderRadius={4}\n * style={styles.payButton}\n * />\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport function ApplePayButton({\n onPress,\n buttonStyle = 'black',\n type = 'plain',\n borderRadius = 4,\n ...props\n}: Props) {\n const buttonType = useMemo(() => mapButtonType(type), [type]);\n const style = useMemo(() => mapButtonStyle(buttonStyle), [buttonStyle]);\n\n return (\n <ApplePayButtonNative\n type={buttonType}\n buttonStyle={style}\n borderRadius={borderRadius}\n onPressAction={onPress}\n {...props}\n />\n );\n}\n\nfunction mapButtonType(type: ApplePayButtonComponent.Type) {\n switch (type) {\n case 'plain':\n return 0;\n case 'buy':\n return 1;\n case 'setUp':\n return 2;\n case 'inStore':\n return 3;\n case 'donate':\n return 4;\n case 'checkout':\n return 5;\n case 'book':\n return 6;\n case 'subscribe':\n return 7;\n case 'reload':\n return 8;\n case 'addMoney':\n return 9;\n case 'topUp':\n return 10;\n case 'order':\n return 11;\n case 'rent':\n return 12;\n case 'support':\n return 13;\n case 'contribute':\n return 14;\n case 'tip':\n return 15;\n default:\n return 0;\n }\n}\n\nfunction mapButtonStyle(type: ApplePayButtonComponent.Style) {\n switch (type) {\n case 'white':\n return 0;\n case 'whiteOutline':\n return 1;\n case 'black':\n return 2;\n case 'automatic':\n return 3;\n default:\n return 2;\n }\n}\n"],"mappings":"kXAAA,qDACA,oFAA0D,6pCAiCnD,QAASA,eAAc,MAMpB,IALRC,QAAO,MAAPA,OAAO,uBACPC,WAAW,CAAXA,WAAW,2BAAG,OAAO,iCACrBC,IAAI,CAAJA,IAAI,oBAAG,OAAO,kCACdC,YAAY,CAAZA,YAAY,4BAAG,CAAC,mBACbC,KAAK,uDAER,GAAMC,WAAU,CAAG,GAAAC,cAAO,EAAC,iBAAMC,cAAa,CAACL,IAAI,CAAC,GAAE,CAACA,IAAI,CAAC,CAAC,CAC7D,GAAMM,MAAK,CAAG,GAAAF,cAAO,EAAC,iBAAMG,eAAc,CAACR,WAAW,CAAC,GAAE,CAACA,WAAW,CAAC,CAAC,CAEvE,MACE,8BAAC,6BAAoB,wBACnB,IAAI,CAAEI,UAAW,CACjB,WAAW,CAAEG,KAAM,CACnB,YAAY,CAAEL,YAAa,CAC3B,aAAa,CAAEH,OAAQ,EACnBI,KAAK,8EACT,CAEN,CAEA,QAASG,cAAa,CAACL,IAAkC,CAAE,CACzD,OAAQA,IAAI,EACV,IAAK,OAAO,CACV,MAAO,EAAC,CACV,IAAK,KAAK,CACR,MAAO,EAAC,CACV,IAAK,OAAO,CACV,MAAO,EAAC,CACV,IAAK,SAAS,CACZ,MAAO,EAAC,CACV,IAAK,QAAQ,CACX,MAAO,EAAC,CACV,IAAK,UAAU,CACb,MAAO,EAAC,CACV,IAAK,MAAM,CACT,MAAO,EAAC,CACV,IAAK,WAAW,CACd,MAAO,EAAC,CACV,IAAK,QAAQ,CACX,MAAO,EAAC,CACV,IAAK,UAAU,CACb,MAAO,EAAC,CACV,IAAK,OAAO,CACV,MAAO,GAAE,CACX,IAAK,OAAO,CACV,MAAO,GAAE,CACX,IAAK,MAAM,CACT,MAAO,GAAE,CACX,IAAK,SAAS,CACZ,MAAO,GAAE,CACX,IAAK,YAAY,CACf,MAAO,GAAE,CACX,IAAK,KAAK,CACR,MAAO,GAAE,CACX,QACE,MAAO,EAAC,CAAC,CAEf,CAEA,QAASO,eAAc,CAACP,IAAmC,CAAE,CAC3D,OAAQA,IAAI,EACV,IAAK,OAAO,CACV,MAAO,EAAC,CACV,IAAK,cAAc,CACjB,MAAO,EAAC,CACV,IAAK,OAAO,CACV,MAAO,EAAC,CACV,IAAK,WAAW,CACd,MAAO,EAAC,CACV,QACE,MAAO,EAAC,CAAC,CAEf"}
@@ -1,2 +0,0 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.GooglePayButton=GooglePayButton;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _GooglePayButtonNative=_interopRequireDefault(require("./GooglePayButtonNative"));var _jsxFileName="/Users/charliecruzan/stripe/stripe-react-native/src/components/GooglePayButton.tsx";var _excluded=["type","onPress","disabled"];function GooglePayButton(_ref){var _ref$type=_ref.type,type=_ref$type===void 0?'pay':_ref$type,onPress=_ref.onPress,disabled=_ref.disabled,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);return _react.default.createElement(_reactNative.TouchableOpacity,{disabled:disabled,activeOpacity:1,onPress:onPress,style:disabled?styles.disabled:{},__self:this,__source:{fileName:_jsxFileName,lineNumber:43,columnNumber:5}},_react.default.createElement(_GooglePayButtonNative.default,(0,_extends2.default)({buttonType:type},props,{__self:this,__source:{fileName:_jsxFileName,lineNumber:49,columnNumber:7}})));}var styles=_reactNative.StyleSheet.create({disabled:{opacity:0.3}});
2
- //# sourceMappingURL=GooglePayButton.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["GooglePayButton","type","onPress","disabled","props","styles","StyleSheet","create","opacity"],"sources":["GooglePayButton.tsx"],"sourcesContent":["import React from 'react';\nimport {\n AccessibilityProps,\n StyleProp,\n ViewStyle,\n TouchableOpacity,\n StyleSheet,\n} from 'react-native';\nimport GooglePayButtonNative from './GooglePayButtonNative';\n\n/**\n * Google Pay Button Component Props\n */\nexport interface Props extends AccessibilityProps {\n style?: StyleProp<ViewStyle>;\n type?: 'pay' | 'standard';\n onPress(): void;\n disabled?: boolean;\n testID?: string;\n}\n\n/**\n * Google Pay Button Component\n *\n * @example\n * ```ts\n * <GooglePayButton\n * onPress={pay}\n * style={styles.payButton}\n * />\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport function GooglePayButton({\n type = 'pay',\n onPress,\n disabled,\n ...props\n}: Props) {\n return (\n <TouchableOpacity\n disabled={disabled}\n activeOpacity={1}\n onPress={onPress}\n style={disabled ? styles.disabled : {}}\n >\n <GooglePayButtonNative buttonType={type} {...props} />\n </TouchableOpacity>\n );\n}\n\nconst styles = StyleSheet.create({\n disabled: {\n opacity: 0.3,\n },\n});\n"],"mappings":"oXAAA,oDACA,yCAOA,sFAA4D,kJA2BrD,QAASA,gBAAe,MAKrB,oBAJRC,IAAI,CAAJA,IAAI,oBAAG,KAAK,WACZC,OAAO,MAAPA,OAAO,CACPC,QAAQ,MAARA,QAAQ,CACLC,KAAK,uDAER,MACE,8BAAC,6BAAgB,EACf,QAAQ,CAAED,QAAS,CACnB,aAAa,CAAE,CAAE,CACjB,OAAO,CAAED,OAAQ,CACjB,KAAK,CAAEC,QAAQ,CAAGE,MAAM,CAACF,QAAQ,CAAG,CAAC,CAAE,4EAEvC,6BAAC,8BAAqB,wBAAC,UAAU,CAAEF,IAAK,EAAKG,KAAK,8EAAI,CACrC,CAEvB,CAEA,GAAMC,OAAM,CAAGC,uBAAU,CAACC,MAAM,CAAC,CAC/BJ,QAAQ,CAAE,CACRK,OAAO,CAAE,GACX,CACF,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useApplePay=useApplePay;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=require("react");var _useStripe2=require("./useStripe");var _reactNative=require("react-native");var SET_SHIPPING_METHOD_CALLBACK_NAME='onDidSetShippingMethod';var SET_SHIPPING_CONTACT_CALLBACK_NAME='onDidSetShippingContact';function useApplePay(){var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},onShippingMethodSelected=_ref.onShippingMethodSelected,onShippingContactSelected=_ref.onShippingContactSelected;var _useStripe=(0,_useStripe2.useStripe)(),isApplePaySupported=_useStripe.isApplePaySupported,_presentApplePay=_useStripe.presentApplePay,_confirmApplePayPayment=_useStripe.confirmApplePayPayment,updateApplePaySummaryItems=_useStripe.updateApplePaySummaryItems,_openApplePaySetup=_useStripe.openApplePaySetup;var _useState=(0,_react.useState)(null),_useState2=(0,_slicedToArray2.default)(_useState,2),items=_useState2[0],setItems=_useState2[1];var _useState3=(0,_react.useState)(false),_useState4=(0,_slicedToArray2.default)(_useState3,2),loading=_useState4[0],setLoading=_useState4[1];var onDidSetShippingMethod=(0,_react.useCallback)(function(result){if(onShippingMethodSelected){onShippingMethodSelected(result.shippingMethod,updateApplePaySummaryItems);}else{updateApplePaySummaryItems(items);}},[items,onShippingMethodSelected,updateApplePaySummaryItems]);var onDidSetShippingContact=(0,_react.useCallback)(function(result){if(onShippingContactSelected){onShippingContactSelected(result.shippingContact,updateApplePaySummaryItems);}else{updateApplePaySummaryItems(items);}},[items,onShippingContactSelected,updateApplePaySummaryItems]);(0,_react.useEffect)(function(){var eventEmitter=new _reactNative.NativeEventEmitter(_reactNative.NativeModules.StripeSdk);var didSetShippingMethodListener=eventEmitter.addListener(SET_SHIPPING_METHOD_CALLBACK_NAME,onDidSetShippingMethod);var didSetShippingContactListener=eventEmitter.addListener(SET_SHIPPING_CONTACT_CALLBACK_NAME,onDidSetShippingContact);return function(){didSetShippingMethodListener.remove();didSetShippingContactListener.remove();};},[onDidSetShippingContact,onDidSetShippingMethod]);var presentApplePay=(0,_react.useCallback)(function(){var _ref2=(0,_asyncToGenerator2.default)(function*(params){setLoading(true);setItems(params.cartItems);var result=yield _presentApplePay(params);if(result.error){setItems(null);}setLoading(false);return result;});return function(_x){return _ref2.apply(this,arguments);};}(),[_presentApplePay]);var openApplePaySetup=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){setLoading(true);var result=yield _openApplePaySetup();setLoading(false);return result;}),[_openApplePaySetup]);var confirmApplePayPayment=(0,_react.useCallback)(function(){var _ref4=(0,_asyncToGenerator2.default)(function*(clientSecret){setLoading(true);var result=yield _confirmApplePayPayment(clientSecret);setItems(null);setLoading(false);return result;});return function(_x2){return _ref4.apply(this,arguments);};}(),[_confirmApplePayPayment]);return{loading:loading,presentApplePay:presentApplePay,confirmApplePayPayment:confirmApplePayPayment,isApplePaySupported:isApplePaySupported,openApplePaySetup:openApplePaySetup};}
2
- //# sourceMappingURL=useApplePay.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["SET_SHIPPING_METHOD_CALLBACK_NAME","SET_SHIPPING_CONTACT_CALLBACK_NAME","useApplePay","onShippingMethodSelected","onShippingContactSelected","useStripe","isApplePaySupported","_presentApplePay","presentApplePay","_confirmApplePayPayment","confirmApplePayPayment","updateApplePaySummaryItems","_openApplePaySetup","openApplePaySetup","useState","items","setItems","loading","setLoading","onDidSetShippingMethod","useCallback","result","shippingMethod","onDidSetShippingContact","shippingContact","useEffect","eventEmitter","NativeEventEmitter","NativeModules","StripeSdk","didSetShippingMethodListener","addListener","didSetShippingContactListener","remove","params","cartItems","error","clientSecret"],"sources":["useApplePay.tsx"],"sourcesContent":["import type { ApplePay, ApplePayError, StripeError } from '../types';\nimport { useCallback, useEffect, useState } from 'react';\nimport { useStripe } from './useStripe';\nimport { NativeEventEmitter, NativeModules } from 'react-native';\n\nexport interface Props {\n /**\n *\n * @example\n * ```ts\n * const { presentApplePay } = useApplePay({\n * onShippingMethodSelected: (shippingMethod, handler) => {\n * handler([\n * { label: 'Example item name 1', amount: '11.00' },\n * { label: 'Example item name 2', amount: '25.00' },\n * ]);\n * }\n * })\n * ```\n */\n onShippingMethodSelected?: (\n shippingMethod: ApplePay.ShippingMethod,\n handler: (summaryItems: ApplePay.CartSummaryItem[]) => Promise<{\n error?: StripeError<ApplePayError>;\n }>\n ) => void;\n /**\n *\n * @example\n * ```ts\n * const { presentApplePay } = useApplePay({\n * onShippingContactSelected: (shippingContact, handler) => {\n * handler([\n * { label: 'Example item name 1', amount: '11.00' },\n * { label: 'Example item name 2', amount: '25.00' },\n * ], [\n * { field: 'city', message: 'city error' },\n * ]);\n * }\n * })\n * ```\n */\n onShippingContactSelected?: (\n shippingContact: ApplePay.ShippingContact,\n handler: (\n summaryItems: ApplePay.CartSummaryItem[],\n errorAddressFields?: Array<{\n field: ApplePay.AddressFields;\n message?: string;\n }>\n ) => Promise<{\n error?: StripeError<ApplePayError>;\n }>\n ) => void;\n}\n\nconst SET_SHIPPING_METHOD_CALLBACK_NAME = 'onDidSetShippingMethod';\nconst SET_SHIPPING_CONTACT_CALLBACK_NAME = 'onDidSetShippingContact';\n\n/**\n * useApplePay hook\n */\nexport function useApplePay({\n onShippingMethodSelected,\n onShippingContactSelected,\n}: Props = {}) {\n const {\n isApplePaySupported,\n presentApplePay: _presentApplePay,\n confirmApplePayPayment: _confirmApplePayPayment,\n updateApplePaySummaryItems,\n openApplePaySetup: _openApplePaySetup,\n } = useStripe();\n const [items, setItems] = useState<ApplePay.CartSummaryItem[] | null>(null);\n const [loading, setLoading] = useState(false);\n\n const onDidSetShippingMethod = useCallback(\n (result: { shippingMethod: ApplePay.ShippingMethod }) => {\n if (onShippingMethodSelected) {\n onShippingMethodSelected(\n result.shippingMethod,\n updateApplePaySummaryItems\n );\n } else {\n updateApplePaySummaryItems(items as ApplePay.CartSummaryItem[]);\n }\n },\n [items, onShippingMethodSelected, updateApplePaySummaryItems]\n );\n\n const onDidSetShippingContact = useCallback(\n (result: { shippingContact: ApplePay.ShippingContact }) => {\n if (onShippingContactSelected) {\n onShippingContactSelected(\n result.shippingContact,\n updateApplePaySummaryItems\n );\n } else {\n updateApplePaySummaryItems(items as ApplePay.CartSummaryItem[]);\n }\n },\n [items, onShippingContactSelected, updateApplePaySummaryItems]\n );\n\n useEffect(() => {\n const eventEmitter = new NativeEventEmitter(NativeModules.StripeSdk);\n const didSetShippingMethodListener = eventEmitter.addListener(\n SET_SHIPPING_METHOD_CALLBACK_NAME,\n onDidSetShippingMethod\n );\n const didSetShippingContactListener = eventEmitter.addListener(\n SET_SHIPPING_CONTACT_CALLBACK_NAME,\n onDidSetShippingContact\n );\n\n return () => {\n didSetShippingMethodListener.remove();\n didSetShippingContactListener.remove();\n };\n }, [onDidSetShippingContact, onDidSetShippingMethod]);\n\n const presentApplePay = useCallback(\n async (params: ApplePay.PresentParams) => {\n setLoading(true);\n setItems(params.cartItems);\n const result = await _presentApplePay(params);\n if (result.error) {\n setItems(null);\n }\n setLoading(false);\n return result;\n },\n [_presentApplePay]\n );\n\n const openApplePaySetup = useCallback(async () => {\n setLoading(true);\n const result = await _openApplePaySetup();\n setLoading(false);\n return result;\n }, [_openApplePaySetup]);\n\n const confirmApplePayPayment = useCallback(\n async (clientSecret: string) => {\n setLoading(true);\n const result = await _confirmApplePayPayment(clientSecret);\n setItems(null);\n setLoading(false);\n return result;\n },\n [_confirmApplePayPayment]\n );\n\n return {\n loading,\n presentApplePay,\n confirmApplePayPayment,\n isApplePaySupported,\n openApplePaySetup,\n };\n}\n"],"mappings":"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"}
@@ -1,2 +0,0 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useGooglePay=useGooglePay;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=require("react");var _useStripe2=require("./useStripe");function useGooglePay(){var _useStripe=(0,_useStripe2.useStripe)(),isGooglePaySupported=_useStripe.isGooglePaySupported,initGooglePay=_useStripe.initGooglePay,presentGooglePay=_useStripe.presentGooglePay,createGooglePayPaymentMethod=_useStripe.createGooglePayPaymentMethod;var _useState=(0,_react.useState)(false),_useState2=(0,_slicedToArray2.default)(_useState,2),loading=_useState2[0],setLoading=_useState2[1];var _isGooglePaySupported=(0,_react.useCallback)(function(){var _ref=(0,_asyncToGenerator2.default)(function*(params){setLoading(true);var result=yield isGooglePaySupported(params);setLoading(false);return result;});return function(_x){return _ref.apply(this,arguments);};}(),[isGooglePaySupported]);var _initGooglePay=(0,_react.useCallback)(function(){var _ref2=(0,_asyncToGenerator2.default)(function*(params){setLoading(true);var result=yield initGooglePay(params);setLoading(false);return result;});return function(_x2){return _ref2.apply(this,arguments);};}(),[initGooglePay]);var _presentGooglePay=(0,_react.useCallback)(function(){var _ref3=(0,_asyncToGenerator2.default)(function*(params){setLoading(true);var result=yield presentGooglePay(params);setLoading(false);return result;});return function(_x3){return _ref3.apply(this,arguments);};}(),[presentGooglePay]);var _createGooglePayPaymentMethod=(0,_react.useCallback)(function(){var _ref4=(0,_asyncToGenerator2.default)(function*(params){setLoading(true);var result=yield createGooglePayPaymentMethod(params);setLoading(false);return result;});return function(_x4){return _ref4.apply(this,arguments);};}(),[createGooglePayPaymentMethod]);return{loading:loading,isGooglePaySupported:_isGooglePaySupported,initGooglePay:_initGooglePay,presentGooglePay:_presentGooglePay,createGooglePayPaymentMethod:_createGooglePayPaymentMethod};}
2
- //# sourceMappingURL=useGooglePay.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useGooglePay","useStripe","isGooglePaySupported","initGooglePay","presentGooglePay","createGooglePayPaymentMethod","useState","loading","setLoading","_isGooglePaySupported","useCallback","params","result","_initGooglePay","_presentGooglePay","_createGooglePayPaymentMethod"],"sources":["useGooglePay.tsx"],"sourcesContent":["import { useCallback, useState } from 'react';\nimport type { GooglePay } from '../types';\nimport { useStripe } from './useStripe';\n\n/**\n * useGooglePay hook\n */\nexport function useGooglePay() {\n const {\n isGooglePaySupported,\n initGooglePay,\n presentGooglePay,\n createGooglePayPaymentMethod,\n } = useStripe();\n const [loading, setLoading] = useState(false);\n\n const _isGooglePaySupported = useCallback(\n async (params?: GooglePay.IsSupportedParams) => {\n setLoading(true);\n\n const result = await isGooglePaySupported(params);\n setLoading(false);\n\n return result;\n },\n [isGooglePaySupported]\n );\n\n const _initGooglePay = useCallback(\n async (params: GooglePay.InitParams) => {\n setLoading(true);\n\n const result = await initGooglePay(params);\n setLoading(false);\n\n return result;\n },\n [initGooglePay]\n );\n\n const _presentGooglePay = useCallback(\n async (params: GooglePay.PresentParams) => {\n setLoading(true);\n\n const result = await presentGooglePay(params);\n setLoading(false);\n\n return result;\n },\n [presentGooglePay]\n );\n\n const _createGooglePayPaymentMethod = useCallback(\n async (params: GooglePay.CreatePaymentMethodParams) => {\n setLoading(true);\n\n const result = await createGooglePayPaymentMethod(params);\n setLoading(false);\n\n return result;\n },\n [createGooglePayPaymentMethod]\n );\n\n return {\n loading,\n isGooglePaySupported: _isGooglePaySupported,\n initGooglePay: _initGooglePay,\n presentGooglePay: _presentGooglePay,\n createGooglePayPaymentMethod: _createGooglePayPaymentMethod,\n };\n}\n"],"mappings":"4WAAA,4BAEA,uCAKO,QAASA,aAAY,EAAG,CAC7B,eAKI,GAAAC,qBAAS,GAAE,CAJbC,oBAAoB,YAApBA,oBAAoB,CACpBC,aAAa,YAAbA,aAAa,CACbC,gBAAgB,YAAhBA,gBAAgB,CAChBC,4BAA4B,YAA5BA,4BAA4B,CAE9B,cAA8B,GAAAC,eAAQ,EAAC,KAAK,CAAC,qDAAtCC,OAAO,eAAEC,UAAU,eAE1B,GAAMC,sBAAqB,CAAG,GAAAC,kBAAW,qDACvC,UAAOC,MAAoC,CAAK,CAC9CH,UAAU,CAAC,IAAI,CAAC,CAEhB,GAAMI,OAAM,MAASV,qBAAoB,CAACS,MAAM,CAAC,CACjDH,UAAU,CAAC,KAAK,CAAC,CAEjB,MAAOI,OAAM,CACf,CAAC,8DACD,CAACV,oBAAoB,CAAC,CACvB,CAED,GAAMW,eAAc,CAAG,GAAAH,kBAAW,sDAChC,UAAOC,MAA4B,CAAK,CACtCH,UAAU,CAAC,IAAI,CAAC,CAEhB,GAAMI,OAAM,MAAST,cAAa,CAACQ,MAAM,CAAC,CAC1CH,UAAU,CAAC,KAAK,CAAC,CAEjB,MAAOI,OAAM,CACf,CAAC,gEACD,CAACT,aAAa,CAAC,CAChB,CAED,GAAMW,kBAAiB,CAAG,GAAAJ,kBAAW,sDACnC,UAAOC,MAA+B,CAAK,CACzCH,UAAU,CAAC,IAAI,CAAC,CAEhB,GAAMI,OAAM,MAASR,iBAAgB,CAACO,MAAM,CAAC,CAC7CH,UAAU,CAAC,KAAK,CAAC,CAEjB,MAAOI,OAAM,CACf,CAAC,gEACD,CAACR,gBAAgB,CAAC,CACnB,CAED,GAAMW,8BAA6B,CAAG,GAAAL,kBAAW,sDAC/C,UAAOC,MAA2C,CAAK,CACrDH,UAAU,CAAC,IAAI,CAAC,CAEhB,GAAMI,OAAM,MAASP,6BAA4B,CAACM,MAAM,CAAC,CACzDH,UAAU,CAAC,KAAK,CAAC,CAEjB,MAAOI,OAAM,CACf,CAAC,gEACD,CAACP,4BAA4B,CAAC,CAC/B,CAED,MAAO,CACLE,OAAO,CAAPA,OAAO,CACPL,oBAAoB,CAAEO,qBAAqB,CAC3CN,aAAa,CAAEU,cAAc,CAC7BT,gBAAgB,CAAEU,iBAAiB,CACnCT,4BAA4B,CAAEU,6BAChC,CAAC,CACH"}
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=GooglePay.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["GooglePay.ts"],"sourcesContent":["export type PresentParams = PresentType & {\n clientSecret: string;\n};\n\nexport type PresentType =\n | {\n /*\n * Present Google Pay to collect customer payment details and use it to confirm the\n * [SetupIntent] represented by [clientSecret].\n */\n forSetupIntent?: true;\n /*\n * The Google Pay API requires a [currencyCode](https://developers.google.com/pay/api/android/reference/request-objects#TransactionInfo).\n * [currencyCode] is required even though the SetupIntent API does not require it.\n */\n currencyCode: string;\n }\n | {\n /*\n * Present Google Pay to collect customer payment details and use it to confirm the\n * [PaymentIntent] represented by [clientSecret].\n */\n forSetupIntent?: false;\n };\n\nexport type InitParams = {\n merchantName: string;\n countryCode: string;\n /**\n * Billing address collection configuration.\n */\n billingAddressConfig?: BillingAddressConfig;\n /**\n * Flag to indicate whether Google Pay collect the customer's email address.\n *\n * Default to `false`.\n */\n isEmailRequired?: boolean;\n} & IsSupportedParams;\n\nexport type IsSupportedParams = {\n /** Set to true to run in a test environment with relaxed application / merchant requirements. This environment is suggested for early development and for easily testing SDK. Defaults to false. */\n testEnv?: boolean;\n /**\n * If `true`, Google Pay is considered ready if the customer's Google Pay wallet\n * has an existing payment method. Defaults to false.\n */\n existingPaymentMethodRequired?: boolean;\n};\n\nexport interface BillingAddressConfig {\n isRequired?: boolean;\n /**\n * Billing address format required to complete the transaction.\n */\n format?: 'FULL' | 'MIN';\n /**\n * Set to true if a phone number is required to process the transaction.\n */\n isPhoneNumberRequired?: boolean;\n}\n\nexport interface CreatePaymentMethodParams {\n /*\n * ISO 4217 alphabetic currency code. (e.g. \"USD\", \"EUR\")\n */\n currencyCode: string;\n /*\n * Amount intended to be collected. A positive integer representing how much to\n * charge in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100,\n * a zero-decimal currency).\n */\n amount: number;\n}\n"],"mappings":""}
@@ -1,2 +0,0 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.ApplePayButton=ApplePayButton;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _ApplePayButtonNative=_interopRequireDefault(require("./ApplePayButtonNative"));var _jsxFileName="/Users/charliecruzan/stripe/stripe-react-native/src/components/ApplePayButton.tsx";var _excluded=["onPress","buttonStyle","type","borderRadius"];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;}function ApplePayButton(_ref){var onPress=_ref.onPress,_ref$buttonStyle=_ref.buttonStyle,buttonStyle=_ref$buttonStyle===void 0?'black':_ref$buttonStyle,_ref$type=_ref.type,type=_ref$type===void 0?'plain':_ref$type,_ref$borderRadius=_ref.borderRadius,borderRadius=_ref$borderRadius===void 0?4:_ref$borderRadius,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);var buttonType=(0,_react.useMemo)(function(){return mapButtonType(type);},[type]);var style=(0,_react.useMemo)(function(){return mapButtonStyle(buttonStyle);},[buttonStyle]);return _react.default.createElement(_ApplePayButtonNative.default,(0,_extends2.default)({type:buttonType,buttonStyle:style,borderRadius:borderRadius,onPressAction:onPress},props,{__self:this,__source:{fileName:_jsxFileName,lineNumber:46,columnNumber:5}}));}function mapButtonType(type){switch(type){case'plain':return 0;case'buy':return 1;case'setUp':return 2;case'inStore':return 3;case'donate':return 4;case'checkout':return 5;case'book':return 6;case'subscribe':return 7;case'reload':return 8;case'addMoney':return 9;case'topUp':return 10;case'order':return 11;case'rent':return 12;case'support':return 13;case'contribute':return 14;case'tip':return 15;default:return 0;}}function mapButtonStyle(type){switch(type){case'white':return 0;case'whiteOutline':return 1;case'black':return 2;case'automatic':return 3;default:return 2;}}
2
- //# sourceMappingURL=ApplePayButton.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["ApplePayButton","onPress","buttonStyle","type","borderRadius","props","buttonType","useMemo","mapButtonType","style","mapButtonStyle"],"sources":["ApplePayButton.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport ApplePayButtonNative from './ApplePayButtonNative';\nimport type { AccessibilityProps, StyleProp, ViewStyle } from 'react-native';\nimport type { ApplePayButtonComponent } from '../types';\n\n/**\n * Apple Pay Button Component Props\n */\nexport interface Props extends AccessibilityProps {\n style?: StyleProp<ViewStyle>;\n type?: ApplePayButtonComponent.Type;\n buttonStyle?: ApplePayButtonComponent.Style;\n borderRadius?: number;\n onPress(): void;\n testID?: string;\n}\n\n/**\n * Apple Pay Button Component\n *\n * @example\n * ```ts\n * <ApplePayButton\n * onPress={pay}\n * type=\"plain\"\n * buttonStyle=\"black\"\n * borderRadius={4}\n * style={styles.payButton}\n * />\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport function ApplePayButton({\n onPress,\n buttonStyle = 'black',\n type = 'plain',\n borderRadius = 4,\n ...props\n}: Props) {\n const buttonType = useMemo(() => mapButtonType(type), [type]);\n const style = useMemo(() => mapButtonStyle(buttonStyle), [buttonStyle]);\n\n return (\n <ApplePayButtonNative\n type={buttonType}\n buttonStyle={style}\n borderRadius={borderRadius}\n onPressAction={onPress}\n {...props}\n />\n );\n}\n\nfunction mapButtonType(type: ApplePayButtonComponent.Type) {\n switch (type) {\n case 'plain':\n return 0;\n case 'buy':\n return 1;\n case 'setUp':\n return 2;\n case 'inStore':\n return 3;\n case 'donate':\n return 4;\n case 'checkout':\n return 5;\n case 'book':\n return 6;\n case 'subscribe':\n return 7;\n case 'reload':\n return 8;\n case 'addMoney':\n return 9;\n case 'topUp':\n return 10;\n case 'order':\n return 11;\n case 'rent':\n return 12;\n case 'support':\n return 13;\n case 'contribute':\n return 14;\n case 'tip':\n return 15;\n default:\n return 0;\n }\n}\n\nfunction mapButtonStyle(type: ApplePayButtonComponent.Style) {\n switch (type) {\n case 'white':\n return 0;\n case 'whiteOutline':\n return 1;\n case 'black':\n return 2;\n case 'automatic':\n return 3;\n default:\n return 2;\n }\n}\n"],"mappings":"kXAAA,qDACA,oFAA0D,6pCAiCnD,QAASA,eAAc,MAMpB,IALRC,QAAO,MAAPA,OAAO,uBACPC,WAAW,CAAXA,WAAW,2BAAG,OAAO,iCACrBC,IAAI,CAAJA,IAAI,oBAAG,OAAO,kCACdC,YAAY,CAAZA,YAAY,4BAAG,CAAC,mBACbC,KAAK,uDAER,GAAMC,WAAU,CAAG,GAAAC,cAAO,EAAC,iBAAMC,cAAa,CAACL,IAAI,CAAC,GAAE,CAACA,IAAI,CAAC,CAAC,CAC7D,GAAMM,MAAK,CAAG,GAAAF,cAAO,EAAC,iBAAMG,eAAc,CAACR,WAAW,CAAC,GAAE,CAACA,WAAW,CAAC,CAAC,CAEvE,MACE,8BAAC,6BAAoB,wBACnB,IAAI,CAAEI,UAAW,CACjB,WAAW,CAAEG,KAAM,CACnB,YAAY,CAAEL,YAAa,CAC3B,aAAa,CAAEH,OAAQ,EACnBI,KAAK,8EACT,CAEN,CAEA,QAASG,cAAa,CAACL,IAAkC,CAAE,CACzD,OAAQA,IAAI,EACV,IAAK,OAAO,CACV,MAAO,EAAC,CACV,IAAK,KAAK,CACR,MAAO,EAAC,CACV,IAAK,OAAO,CACV,MAAO,EAAC,CACV,IAAK,SAAS,CACZ,MAAO,EAAC,CACV,IAAK,QAAQ,CACX,MAAO,EAAC,CACV,IAAK,UAAU,CACb,MAAO,EAAC,CACV,IAAK,MAAM,CACT,MAAO,EAAC,CACV,IAAK,WAAW,CACd,MAAO,EAAC,CACV,IAAK,QAAQ,CACX,MAAO,EAAC,CACV,IAAK,UAAU,CACb,MAAO,EAAC,CACV,IAAK,OAAO,CACV,MAAO,GAAE,CACX,IAAK,OAAO,CACV,MAAO,GAAE,CACX,IAAK,MAAM,CACT,MAAO,GAAE,CACX,IAAK,SAAS,CACZ,MAAO,GAAE,CACX,IAAK,YAAY,CACf,MAAO,GAAE,CACX,IAAK,KAAK,CACR,MAAO,GAAE,CACX,QACE,MAAO,EAAC,CAAC,CAEf,CAEA,QAASO,eAAc,CAACP,IAAmC,CAAE,CAC3D,OAAQA,IAAI,EACV,IAAK,OAAO,CACV,MAAO,EAAC,CACV,IAAK,cAAc,CACjB,MAAO,EAAC,CACV,IAAK,OAAO,CACV,MAAO,EAAC,CACV,IAAK,WAAW,CACd,MAAO,EAAC,CACV,QACE,MAAO,EAAC,CAAC,CAEf"}
@@ -1,2 +0,0 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.GooglePayButton=GooglePayButton;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _GooglePayButtonNative=_interopRequireDefault(require("./GooglePayButtonNative"));var _jsxFileName="/Users/charliecruzan/stripe/stripe-react-native/src/components/GooglePayButton.tsx";var _excluded=["type","onPress","disabled"];function GooglePayButton(_ref){var _ref$type=_ref.type,type=_ref$type===void 0?'pay':_ref$type,onPress=_ref.onPress,disabled=_ref.disabled,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);return _react.default.createElement(_reactNative.TouchableOpacity,{disabled:disabled,activeOpacity:1,onPress:onPress,style:disabled?styles.disabled:{},__self:this,__source:{fileName:_jsxFileName,lineNumber:43,columnNumber:5}},_react.default.createElement(_GooglePayButtonNative.default,(0,_extends2.default)({buttonType:type},props,{__self:this,__source:{fileName:_jsxFileName,lineNumber:49,columnNumber:7}})));}var styles=_reactNative.StyleSheet.create({disabled:{opacity:0.3}});
2
- //# sourceMappingURL=GooglePayButton.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["GooglePayButton","type","onPress","disabled","props","styles","StyleSheet","create","opacity"],"sources":["GooglePayButton.tsx"],"sourcesContent":["import React from 'react';\nimport {\n AccessibilityProps,\n StyleProp,\n ViewStyle,\n TouchableOpacity,\n StyleSheet,\n} from 'react-native';\nimport GooglePayButtonNative from './GooglePayButtonNative';\n\n/**\n * Google Pay Button Component Props\n */\nexport interface Props extends AccessibilityProps {\n style?: StyleProp<ViewStyle>;\n type?: 'pay' | 'standard';\n onPress(): void;\n disabled?: boolean;\n testID?: string;\n}\n\n/**\n * Google Pay Button Component\n *\n * @example\n * ```ts\n * <GooglePayButton\n * onPress={pay}\n * style={styles.payButton}\n * />\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport function GooglePayButton({\n type = 'pay',\n onPress,\n disabled,\n ...props\n}: Props) {\n return (\n <TouchableOpacity\n disabled={disabled}\n activeOpacity={1}\n onPress={onPress}\n style={disabled ? styles.disabled : {}}\n >\n <GooglePayButtonNative buttonType={type} {...props} />\n </TouchableOpacity>\n );\n}\n\nconst styles = StyleSheet.create({\n disabled: {\n opacity: 0.3,\n },\n});\n"],"mappings":"oXAAA,oDACA,yCAOA,sFAA4D,kJA2BrD,QAASA,gBAAe,MAKrB,oBAJRC,IAAI,CAAJA,IAAI,oBAAG,KAAK,WACZC,OAAO,MAAPA,OAAO,CACPC,QAAQ,MAARA,QAAQ,CACLC,KAAK,uDAER,MACE,8BAAC,6BAAgB,EACf,QAAQ,CAAED,QAAS,CACnB,aAAa,CAAE,CAAE,CACjB,OAAO,CAAED,OAAQ,CACjB,KAAK,CAAEC,QAAQ,CAAGE,MAAM,CAACF,QAAQ,CAAG,CAAC,CAAE,4EAEvC,6BAAC,8BAAqB,wBAAC,UAAU,CAAEF,IAAK,EAAKG,KAAK,8EAAI,CACrC,CAEvB,CAEA,GAAMC,OAAM,CAAGC,uBAAU,CAACC,MAAM,CAAC,CAC/BJ,QAAQ,CAAE,CACRK,OAAO,CAAE,GACX,CACF,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useApplePay=useApplePay;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=require("react");var _useStripe2=require("./useStripe");var _reactNative=require("react-native");var SET_SHIPPING_METHOD_CALLBACK_NAME='onDidSetShippingMethod';var SET_SHIPPING_CONTACT_CALLBACK_NAME='onDidSetShippingContact';function useApplePay(){var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},onShippingMethodSelected=_ref.onShippingMethodSelected,onShippingContactSelected=_ref.onShippingContactSelected;var _useStripe=(0,_useStripe2.useStripe)(),isApplePaySupported=_useStripe.isApplePaySupported,_presentApplePay=_useStripe.presentApplePay,_confirmApplePayPayment=_useStripe.confirmApplePayPayment,updateApplePaySummaryItems=_useStripe.updateApplePaySummaryItems,_openApplePaySetup=_useStripe.openApplePaySetup;var _useState=(0,_react.useState)(null),_useState2=(0,_slicedToArray2.default)(_useState,2),items=_useState2[0],setItems=_useState2[1];var _useState3=(0,_react.useState)(false),_useState4=(0,_slicedToArray2.default)(_useState3,2),loading=_useState4[0],setLoading=_useState4[1];var onDidSetShippingMethod=(0,_react.useCallback)(function(result){if(onShippingMethodSelected){onShippingMethodSelected(result.shippingMethod,updateApplePaySummaryItems);}else{updateApplePaySummaryItems(items);}},[items,onShippingMethodSelected,updateApplePaySummaryItems]);var onDidSetShippingContact=(0,_react.useCallback)(function(result){if(onShippingContactSelected){onShippingContactSelected(result.shippingContact,updateApplePaySummaryItems);}else{updateApplePaySummaryItems(items);}},[items,onShippingContactSelected,updateApplePaySummaryItems]);(0,_react.useEffect)(function(){var eventEmitter=new _reactNative.NativeEventEmitter(_reactNative.NativeModules.StripeSdk);var didSetShippingMethodListener=eventEmitter.addListener(SET_SHIPPING_METHOD_CALLBACK_NAME,onDidSetShippingMethod);var didSetShippingContactListener=eventEmitter.addListener(SET_SHIPPING_CONTACT_CALLBACK_NAME,onDidSetShippingContact);return function(){didSetShippingMethodListener.remove();didSetShippingContactListener.remove();};},[onDidSetShippingContact,onDidSetShippingMethod]);var presentApplePay=(0,_react.useCallback)(function(){var _ref2=(0,_asyncToGenerator2.default)(function*(params){setLoading(true);setItems(params.cartItems);var result=yield _presentApplePay(params);if(result.error){setItems(null);}setLoading(false);return result;});return function(_x){return _ref2.apply(this,arguments);};}(),[_presentApplePay]);var openApplePaySetup=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){setLoading(true);var result=yield _openApplePaySetup();setLoading(false);return result;}),[_openApplePaySetup]);var confirmApplePayPayment=(0,_react.useCallback)(function(){var _ref4=(0,_asyncToGenerator2.default)(function*(clientSecret){setLoading(true);var result=yield _confirmApplePayPayment(clientSecret);setItems(null);setLoading(false);return result;});return function(_x2){return _ref4.apply(this,arguments);};}(),[_confirmApplePayPayment]);return{loading:loading,presentApplePay:presentApplePay,confirmApplePayPayment:confirmApplePayPayment,isApplePaySupported:isApplePaySupported,openApplePaySetup:openApplePaySetup};}
2
- //# sourceMappingURL=useApplePay.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["SET_SHIPPING_METHOD_CALLBACK_NAME","SET_SHIPPING_CONTACT_CALLBACK_NAME","useApplePay","onShippingMethodSelected","onShippingContactSelected","useStripe","isApplePaySupported","_presentApplePay","presentApplePay","_confirmApplePayPayment","confirmApplePayPayment","updateApplePaySummaryItems","_openApplePaySetup","openApplePaySetup","useState","items","setItems","loading","setLoading","onDidSetShippingMethod","useCallback","result","shippingMethod","onDidSetShippingContact","shippingContact","useEffect","eventEmitter","NativeEventEmitter","NativeModules","StripeSdk","didSetShippingMethodListener","addListener","didSetShippingContactListener","remove","params","cartItems","error","clientSecret"],"sources":["useApplePay.tsx"],"sourcesContent":["import type { ApplePay, ApplePayError, StripeError } from '../types';\nimport { useCallback, useEffect, useState } from 'react';\nimport { useStripe } from './useStripe';\nimport { NativeEventEmitter, NativeModules } from 'react-native';\n\nexport interface Props {\n /**\n *\n * @example\n * ```ts\n * const { presentApplePay } = useApplePay({\n * onShippingMethodSelected: (shippingMethod, handler) => {\n * handler([\n * { label: 'Example item name 1', amount: '11.00' },\n * { label: 'Example item name 2', amount: '25.00' },\n * ]);\n * }\n * })\n * ```\n */\n onShippingMethodSelected?: (\n shippingMethod: ApplePay.ShippingMethod,\n handler: (summaryItems: ApplePay.CartSummaryItem[]) => Promise<{\n error?: StripeError<ApplePayError>;\n }>\n ) => void;\n /**\n *\n * @example\n * ```ts\n * const { presentApplePay } = useApplePay({\n * onShippingContactSelected: (shippingContact, handler) => {\n * handler([\n * { label: 'Example item name 1', amount: '11.00' },\n * { label: 'Example item name 2', amount: '25.00' },\n * ], [\n * { field: 'city', message: 'city error' },\n * ]);\n * }\n * })\n * ```\n */\n onShippingContactSelected?: (\n shippingContact: ApplePay.ShippingContact,\n handler: (\n summaryItems: ApplePay.CartSummaryItem[],\n errorAddressFields?: Array<{\n field: ApplePay.AddressFields;\n message?: string;\n }>\n ) => Promise<{\n error?: StripeError<ApplePayError>;\n }>\n ) => void;\n}\n\nconst SET_SHIPPING_METHOD_CALLBACK_NAME = 'onDidSetShippingMethod';\nconst SET_SHIPPING_CONTACT_CALLBACK_NAME = 'onDidSetShippingContact';\n\n/**\n * useApplePay hook\n */\nexport function useApplePay({\n onShippingMethodSelected,\n onShippingContactSelected,\n}: Props = {}) {\n const {\n isApplePaySupported,\n presentApplePay: _presentApplePay,\n confirmApplePayPayment: _confirmApplePayPayment,\n updateApplePaySummaryItems,\n openApplePaySetup: _openApplePaySetup,\n } = useStripe();\n const [items, setItems] = useState<ApplePay.CartSummaryItem[] | null>(null);\n const [loading, setLoading] = useState(false);\n\n const onDidSetShippingMethod = useCallback(\n (result: { shippingMethod: ApplePay.ShippingMethod }) => {\n if (onShippingMethodSelected) {\n onShippingMethodSelected(\n result.shippingMethod,\n updateApplePaySummaryItems\n );\n } else {\n updateApplePaySummaryItems(items as ApplePay.CartSummaryItem[]);\n }\n },\n [items, onShippingMethodSelected, updateApplePaySummaryItems]\n );\n\n const onDidSetShippingContact = useCallback(\n (result: { shippingContact: ApplePay.ShippingContact }) => {\n if (onShippingContactSelected) {\n onShippingContactSelected(\n result.shippingContact,\n updateApplePaySummaryItems\n );\n } else {\n updateApplePaySummaryItems(items as ApplePay.CartSummaryItem[]);\n }\n },\n [items, onShippingContactSelected, updateApplePaySummaryItems]\n );\n\n useEffect(() => {\n const eventEmitter = new NativeEventEmitter(NativeModules.StripeSdk);\n const didSetShippingMethodListener = eventEmitter.addListener(\n SET_SHIPPING_METHOD_CALLBACK_NAME,\n onDidSetShippingMethod\n );\n const didSetShippingContactListener = eventEmitter.addListener(\n SET_SHIPPING_CONTACT_CALLBACK_NAME,\n onDidSetShippingContact\n );\n\n return () => {\n didSetShippingMethodListener.remove();\n didSetShippingContactListener.remove();\n };\n }, [onDidSetShippingContact, onDidSetShippingMethod]);\n\n const presentApplePay = useCallback(\n async (params: ApplePay.PresentParams) => {\n setLoading(true);\n setItems(params.cartItems);\n const result = await _presentApplePay(params);\n if (result.error) {\n setItems(null);\n }\n setLoading(false);\n return result;\n },\n [_presentApplePay]\n );\n\n const openApplePaySetup = useCallback(async () => {\n setLoading(true);\n const result = await _openApplePaySetup();\n setLoading(false);\n return result;\n }, [_openApplePaySetup]);\n\n const confirmApplePayPayment = useCallback(\n async (clientSecret: string) => {\n setLoading(true);\n const result = await _confirmApplePayPayment(clientSecret);\n setItems(null);\n setLoading(false);\n return result;\n },\n [_confirmApplePayPayment]\n );\n\n return {\n loading,\n presentApplePay,\n confirmApplePayPayment,\n isApplePaySupported,\n openApplePaySetup,\n };\n}\n"],"mappings":"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"}
@@ -1,2 +0,0 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useGooglePay=useGooglePay;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=require("react");var _useStripe2=require("./useStripe");function useGooglePay(){var _useStripe=(0,_useStripe2.useStripe)(),isGooglePaySupported=_useStripe.isGooglePaySupported,initGooglePay=_useStripe.initGooglePay,presentGooglePay=_useStripe.presentGooglePay,createGooglePayPaymentMethod=_useStripe.createGooglePayPaymentMethod;var _useState=(0,_react.useState)(false),_useState2=(0,_slicedToArray2.default)(_useState,2),loading=_useState2[0],setLoading=_useState2[1];var _isGooglePaySupported=(0,_react.useCallback)(function(){var _ref=(0,_asyncToGenerator2.default)(function*(params){setLoading(true);var result=yield isGooglePaySupported(params);setLoading(false);return result;});return function(_x){return _ref.apply(this,arguments);};}(),[isGooglePaySupported]);var _initGooglePay=(0,_react.useCallback)(function(){var _ref2=(0,_asyncToGenerator2.default)(function*(params){setLoading(true);var result=yield initGooglePay(params);setLoading(false);return result;});return function(_x2){return _ref2.apply(this,arguments);};}(),[initGooglePay]);var _presentGooglePay=(0,_react.useCallback)(function(){var _ref3=(0,_asyncToGenerator2.default)(function*(params){setLoading(true);var result=yield presentGooglePay(params);setLoading(false);return result;});return function(_x3){return _ref3.apply(this,arguments);};}(),[presentGooglePay]);var _createGooglePayPaymentMethod=(0,_react.useCallback)(function(){var _ref4=(0,_asyncToGenerator2.default)(function*(params){setLoading(true);var result=yield createGooglePayPaymentMethod(params);setLoading(false);return result;});return function(_x4){return _ref4.apply(this,arguments);};}(),[createGooglePayPaymentMethod]);return{loading:loading,isGooglePaySupported:_isGooglePaySupported,initGooglePay:_initGooglePay,presentGooglePay:_presentGooglePay,createGooglePayPaymentMethod:_createGooglePayPaymentMethod};}
2
- //# sourceMappingURL=useGooglePay.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useGooglePay","useStripe","isGooglePaySupported","initGooglePay","presentGooglePay","createGooglePayPaymentMethod","useState","loading","setLoading","_isGooglePaySupported","useCallback","params","result","_initGooglePay","_presentGooglePay","_createGooglePayPaymentMethod"],"sources":["useGooglePay.tsx"],"sourcesContent":["import { useCallback, useState } from 'react';\nimport type { GooglePay } from '../types';\nimport { useStripe } from './useStripe';\n\n/**\n * useGooglePay hook\n */\nexport function useGooglePay() {\n const {\n isGooglePaySupported,\n initGooglePay,\n presentGooglePay,\n createGooglePayPaymentMethod,\n } = useStripe();\n const [loading, setLoading] = useState(false);\n\n const _isGooglePaySupported = useCallback(\n async (params?: GooglePay.IsSupportedParams) => {\n setLoading(true);\n\n const result = await isGooglePaySupported(params);\n setLoading(false);\n\n return result;\n },\n [isGooglePaySupported]\n );\n\n const _initGooglePay = useCallback(\n async (params: GooglePay.InitParams) => {\n setLoading(true);\n\n const result = await initGooglePay(params);\n setLoading(false);\n\n return result;\n },\n [initGooglePay]\n );\n\n const _presentGooglePay = useCallback(\n async (params: GooglePay.PresentParams) => {\n setLoading(true);\n\n const result = await presentGooglePay(params);\n setLoading(false);\n\n return result;\n },\n [presentGooglePay]\n );\n\n const _createGooglePayPaymentMethod = useCallback(\n async (params: GooglePay.CreatePaymentMethodParams) => {\n setLoading(true);\n\n const result = await createGooglePayPaymentMethod(params);\n setLoading(false);\n\n return result;\n },\n [createGooglePayPaymentMethod]\n );\n\n return {\n loading,\n isGooglePaySupported: _isGooglePaySupported,\n initGooglePay: _initGooglePay,\n presentGooglePay: _presentGooglePay,\n createGooglePayPaymentMethod: _createGooglePayPaymentMethod,\n };\n}\n"],"mappings":"4WAAA,4BAEA,uCAKO,QAASA,aAAY,EAAG,CAC7B,eAKI,GAAAC,qBAAS,GAAE,CAJbC,oBAAoB,YAApBA,oBAAoB,CACpBC,aAAa,YAAbA,aAAa,CACbC,gBAAgB,YAAhBA,gBAAgB,CAChBC,4BAA4B,YAA5BA,4BAA4B,CAE9B,cAA8B,GAAAC,eAAQ,EAAC,KAAK,CAAC,qDAAtCC,OAAO,eAAEC,UAAU,eAE1B,GAAMC,sBAAqB,CAAG,GAAAC,kBAAW,qDACvC,UAAOC,MAAoC,CAAK,CAC9CH,UAAU,CAAC,IAAI,CAAC,CAEhB,GAAMI,OAAM,MAASV,qBAAoB,CAACS,MAAM,CAAC,CACjDH,UAAU,CAAC,KAAK,CAAC,CAEjB,MAAOI,OAAM,CACf,CAAC,8DACD,CAACV,oBAAoB,CAAC,CACvB,CAED,GAAMW,eAAc,CAAG,GAAAH,kBAAW,sDAChC,UAAOC,MAA4B,CAAK,CACtCH,UAAU,CAAC,IAAI,CAAC,CAEhB,GAAMI,OAAM,MAAST,cAAa,CAACQ,MAAM,CAAC,CAC1CH,UAAU,CAAC,KAAK,CAAC,CAEjB,MAAOI,OAAM,CACf,CAAC,gEACD,CAACT,aAAa,CAAC,CAChB,CAED,GAAMW,kBAAiB,CAAG,GAAAJ,kBAAW,sDACnC,UAAOC,MAA+B,CAAK,CACzCH,UAAU,CAAC,IAAI,CAAC,CAEhB,GAAMI,OAAM,MAASR,iBAAgB,CAACO,MAAM,CAAC,CAC7CH,UAAU,CAAC,KAAK,CAAC,CAEjB,MAAOI,OAAM,CACf,CAAC,gEACD,CAACR,gBAAgB,CAAC,CACnB,CAED,GAAMW,8BAA6B,CAAG,GAAAL,kBAAW,sDAC/C,UAAOC,MAA2C,CAAK,CACrDH,UAAU,CAAC,IAAI,CAAC,CAEhB,GAAMI,OAAM,MAASP,6BAA4B,CAACM,MAAM,CAAC,CACzDH,UAAU,CAAC,KAAK,CAAC,CAEjB,MAAOI,OAAM,CACf,CAAC,gEACD,CAACP,4BAA4B,CAAC,CAC/B,CAED,MAAO,CACLE,OAAO,CAAPA,OAAO,CACPL,oBAAoB,CAAEO,qBAAqB,CAC3CN,aAAa,CAAEU,cAAc,CAC7BT,gBAAgB,CAAEU,iBAAiB,CACnCT,4BAA4B,CAAEU,6BAChC,CAAC,CACH"}
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=GooglePay.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["GooglePay.ts"],"sourcesContent":["export type PresentParams = PresentType & {\n clientSecret: string;\n};\n\nexport type PresentType =\n | {\n /*\n * Present Google Pay to collect customer payment details and use it to confirm the\n * [SetupIntent] represented by [clientSecret].\n */\n forSetupIntent?: true;\n /*\n * The Google Pay API requires a [currencyCode](https://developers.google.com/pay/api/android/reference/request-objects#TransactionInfo).\n * [currencyCode] is required even though the SetupIntent API does not require it.\n */\n currencyCode: string;\n }\n | {\n /*\n * Present Google Pay to collect customer payment details and use it to confirm the\n * [PaymentIntent] represented by [clientSecret].\n */\n forSetupIntent?: false;\n };\n\nexport type InitParams = {\n merchantName: string;\n countryCode: string;\n /**\n * Billing address collection configuration.\n */\n billingAddressConfig?: BillingAddressConfig;\n /**\n * Flag to indicate whether Google Pay collect the customer's email address.\n *\n * Default to `false`.\n */\n isEmailRequired?: boolean;\n} & IsSupportedParams;\n\nexport type IsSupportedParams = {\n /** Set to true to run in a test environment with relaxed application / merchant requirements. This environment is suggested for early development and for easily testing SDK. Defaults to false. */\n testEnv?: boolean;\n /**\n * If `true`, Google Pay is considered ready if the customer's Google Pay wallet\n * has an existing payment method. Defaults to false.\n */\n existingPaymentMethodRequired?: boolean;\n};\n\nexport interface BillingAddressConfig {\n isRequired?: boolean;\n /**\n * Billing address format required to complete the transaction.\n */\n format?: 'FULL' | 'MIN';\n /**\n * Set to true if a phone number is required to process the transaction.\n */\n isPhoneNumberRequired?: boolean;\n}\n\nexport interface CreatePaymentMethodParams {\n /*\n * ISO 4217 alphabetic currency code. (e.g. \"USD\", \"EUR\")\n */\n currencyCode: string;\n /*\n * Amount intended to be collected. A positive integer representing how much to\n * charge in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100,\n * a zero-decimal currency).\n */\n amount: number;\n}\n"],"mappings":""}
@@ -1,31 +0,0 @@
1
- import type { AccessibilityProps, StyleProp, ViewStyle } from 'react-native';
2
- import type { ApplePayButtonComponent } from '../types';
3
- /**
4
- * Apple Pay Button Component Props
5
- */
6
- export interface Props extends AccessibilityProps {
7
- style?: StyleProp<ViewStyle>;
8
- type?: ApplePayButtonComponent.Type;
9
- buttonStyle?: ApplePayButtonComponent.Style;
10
- borderRadius?: number;
11
- onPress(): void;
12
- testID?: string;
13
- }
14
- /**
15
- * Apple Pay Button Component
16
- *
17
- * @example
18
- * ```ts
19
- * <ApplePayButton
20
- * onPress={pay}
21
- * type="plain"
22
- * buttonStyle="black"
23
- * borderRadius={4}
24
- * style={styles.payButton}
25
- * />
26
- * ```
27
- * @param __namedParameters Props
28
- * @returns JSX.Element
29
- * @category ReactComponents
30
- */
31
- export declare function ApplePayButton({ onPress, buttonStyle, type, borderRadius, ...props }: Props): JSX.Element;
@@ -1,26 +0,0 @@
1
- import { AccessibilityProps, StyleProp, ViewStyle } from 'react-native';
2
- /**
3
- * Google Pay Button Component Props
4
- */
5
- export interface Props extends AccessibilityProps {
6
- style?: StyleProp<ViewStyle>;
7
- type?: 'pay' | 'standard';
8
- onPress(): void;
9
- disabled?: boolean;
10
- testID?: string;
11
- }
12
- /**
13
- * Google Pay Button Component
14
- *
15
- * @example
16
- * ```ts
17
- * <GooglePayButton
18
- * onPress={pay}
19
- * style={styles.payButton}
20
- * />
21
- * ```
22
- * @param __namedParameters Props
23
- * @returns JSX.Element
24
- * @category ReactComponents
25
- */
26
- export declare function GooglePayButton({ type, onPress, disabled, ...props }: Props): JSX.Element;
@@ -1,54 +0,0 @@
1
- import type { ApplePay, ApplePayError, StripeError } from '../types';
2
- export interface Props {
3
- /**
4
- *
5
- * @example
6
- * ```ts
7
- * const { presentApplePay } = useApplePay({
8
- * onShippingMethodSelected: (shippingMethod, handler) => {
9
- * handler([
10
- * { label: 'Example item name 1', amount: '11.00' },
11
- * { label: 'Example item name 2', amount: '25.00' },
12
- * ]);
13
- * }
14
- * })
15
- * ```
16
- */
17
- onShippingMethodSelected?: (shippingMethod: ApplePay.ShippingMethod, handler: (summaryItems: ApplePay.CartSummaryItem[]) => Promise<{
18
- error?: StripeError<ApplePayError>;
19
- }>) => void;
20
- /**
21
- *
22
- * @example
23
- * ```ts
24
- * const { presentApplePay } = useApplePay({
25
- * onShippingContactSelected: (shippingContact, handler) => {
26
- * handler([
27
- * { label: 'Example item name 1', amount: '11.00' },
28
- * { label: 'Example item name 2', amount: '25.00' },
29
- * ], [
30
- * { field: 'city', message: 'city error' },
31
- * ]);
32
- * }
33
- * })
34
- * ```
35
- */
36
- onShippingContactSelected?: (shippingContact: ApplePay.ShippingContact, handler: (summaryItems: ApplePay.CartSummaryItem[], errorAddressFields?: Array<{
37
- field: ApplePay.AddressFields;
38
- message?: string;
39
- }>) => Promise<{
40
- error?: StripeError<ApplePayError>;
41
- }>) => void;
42
- }
43
- /**
44
- * useApplePay hook
45
- */
46
- export declare function useApplePay({ onShippingMethodSelected, onShippingContactSelected, }?: Props): {
47
- loading: boolean;
48
- presentApplePay: (params: ApplePay.PresentParams) => Promise<import("../types").ApplePayResult>;
49
- confirmApplePayPayment: (clientSecret: string) => Promise<{
50
- error?: StripeError<ApplePayError> | undefined;
51
- }>;
52
- isApplePaySupported: boolean | null;
53
- openApplePaySetup: () => Promise<import("../types").OpenApplePaySetupResult>;
54
- };
@@ -1,11 +0,0 @@
1
- import type { GooglePay } from '../types';
2
- /**
3
- * useGooglePay hook
4
- */
5
- export declare function useGooglePay(): {
6
- loading: boolean;
7
- isGooglePaySupported: (params?: GooglePay.IsSupportedParams | undefined) => Promise<boolean>;
8
- initGooglePay: (params: GooglePay.InitParams) => Promise<import("../types").GooglePayInitResult>;
9
- presentGooglePay: (params: GooglePay.PresentParams) => Promise<import("../types").PayWithGooglePayResult>;
10
- createGooglePayPaymentMethod: (params: GooglePay.CreatePaymentMethodParams) => Promise<import("../types").CreateGooglePayPaymentMethodResult>;
11
- };
@@ -1,47 +0,0 @@
1
- export declare type PresentParams = PresentType & {
2
- clientSecret: string;
3
- };
4
- export declare type PresentType = {
5
- forSetupIntent?: true;
6
- currencyCode: string;
7
- } | {
8
- forSetupIntent?: false;
9
- };
10
- export declare type InitParams = {
11
- merchantName: string;
12
- countryCode: string;
13
- /**
14
- * Billing address collection configuration.
15
- */
16
- billingAddressConfig?: BillingAddressConfig;
17
- /**
18
- * Flag to indicate whether Google Pay collect the customer's email address.
19
- *
20
- * Default to `false`.
21
- */
22
- isEmailRequired?: boolean;
23
- } & IsSupportedParams;
24
- export declare type IsSupportedParams = {
25
- /** Set to true to run in a test environment with relaxed application / merchant requirements. This environment is suggested for early development and for easily testing SDK. Defaults to false. */
26
- testEnv?: boolean;
27
- /**
28
- * If `true`, Google Pay is considered ready if the customer's Google Pay wallet
29
- * has an existing payment method. Defaults to false.
30
- */
31
- existingPaymentMethodRequired?: boolean;
32
- };
33
- export interface BillingAddressConfig {
34
- isRequired?: boolean;
35
- /**
36
- * Billing address format required to complete the transaction.
37
- */
38
- format?: 'FULL' | 'MIN';
39
- /**
40
- * Set to true if a phone number is required to process the transaction.
41
- */
42
- isPhoneNumberRequired?: boolean;
43
- }
44
- export interface CreatePaymentMethodParams {
45
- currencyCode: string;
46
- amount: number;
47
- }