@stripe/stripe-react-native 0.16.0 → 0.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/.husky/pre-commit +4 -0
  2. package/CHANGELOG.md +40 -0
  3. package/README.md +1 -1
  4. package/android/build.gradle +1 -1
  5. package/android/gradle.properties +2 -2
  6. package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +1 -1
  7. package/android/src/main/java/com/reactnativestripesdk/CollectBankAccountLauncherFragment.kt +8 -1
  8. package/android/src/main/java/com/reactnativestripesdk/FinancialConnectionsSheetFragment.kt +278 -0
  9. package/android/src/main/java/com/reactnativestripesdk/GooglePayFragment.kt +4 -0
  10. package/android/src/main/java/com/reactnativestripesdk/GooglePayPaymentMethodLauncherFragment.kt +6 -2
  11. package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherFragment.kt +9 -11
  12. package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +2 -2
  13. package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +3 -1
  14. package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +59 -22
  15. package/android/src/main/java/com/reactnativestripesdk/utils/Errors.kt +4 -0
  16. package/android/src/main/java/com/reactnativestripesdk/utils/Extensions.kt +11 -0
  17. package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +5 -4
  18. package/ios/Errors.swift +12 -1
  19. package/ios/FinancialConnections.swift +258 -0
  20. package/ios/Mappers.swift +12 -9
  21. package/ios/StripeSdk.m +10 -1
  22. package/ios/StripeSdk.swift +51 -8
  23. package/lib/commonjs/NativeStripeSdk.js.map +1 -1
  24. package/lib/commonjs/components/AuBECSDebitForm.js +1 -1
  25. package/lib/commonjs/components/AuBECSDebitForm.js.map +1 -1
  26. package/lib/commonjs/components/CardForm.js +1 -1
  27. package/lib/commonjs/components/CardForm.js.map +1 -1
  28. package/lib/commonjs/components/StripeProvider.js +1 -1
  29. package/lib/commonjs/components/StripeProvider.js.map +1 -1
  30. package/lib/commonjs/functions.js +1 -1
  31. package/lib/commonjs/functions.js.map +1 -1
  32. package/lib/commonjs/hooks/useApplePay.js +1 -1
  33. package/lib/commonjs/hooks/useApplePay.js.map +1 -1
  34. package/lib/commonjs/hooks/useConfirmPayment.js +1 -1
  35. package/lib/commonjs/hooks/useConfirmPayment.js.map +1 -1
  36. package/lib/commonjs/hooks/useConfirmSetupIntent.js +1 -1
  37. package/lib/commonjs/hooks/useConfirmSetupIntent.js.map +1 -1
  38. package/lib/commonjs/hooks/useFinancialConnectionsSheet.js +2 -0
  39. package/lib/commonjs/hooks/useFinancialConnectionsSheet.js.map +1 -0
  40. package/lib/commonjs/hooks/useGooglePay.js +1 -1
  41. package/lib/commonjs/hooks/useGooglePay.js.map +1 -1
  42. package/lib/commonjs/hooks/usePaymentSheet.js +1 -1
  43. package/lib/commonjs/hooks/usePaymentSheet.js.map +1 -1
  44. package/lib/commonjs/hooks/useStripe.js +1 -1
  45. package/lib/commonjs/hooks/useStripe.js.map +1 -1
  46. package/lib/commonjs/index.js +1 -1
  47. package/lib/commonjs/index.js.map +1 -1
  48. package/lib/commonjs/plugin/withStripe.js +1 -1
  49. package/lib/commonjs/plugin/withStripe.js.map +1 -1
  50. package/lib/commonjs/types/FinancialConnections.js +2 -0
  51. package/lib/commonjs/types/FinancialConnections.js.map +1 -0
  52. package/lib/commonjs/types/PaymentIntent.js.map +1 -1
  53. package/lib/commonjs/types/SetupIntent.js.map +1 -1
  54. package/lib/commonjs/types/index.js +1 -1
  55. package/lib/commonjs/types/index.js.map +1 -1
  56. package/lib/module/NativeStripeSdk.js.map +1 -1
  57. package/lib/module/components/AuBECSDebitForm.js +1 -1
  58. package/lib/module/components/AuBECSDebitForm.js.map +1 -1
  59. package/lib/module/components/CardForm.js +1 -1
  60. package/lib/module/components/CardForm.js.map +1 -1
  61. package/lib/module/components/StripeProvider.js +1 -1
  62. package/lib/module/components/StripeProvider.js.map +1 -1
  63. package/lib/module/functions.js +1 -1
  64. package/lib/module/functions.js.map +1 -1
  65. package/lib/module/hooks/useApplePay.js +1 -1
  66. package/lib/module/hooks/useApplePay.js.map +1 -1
  67. package/lib/module/hooks/useConfirmPayment.js +1 -1
  68. package/lib/module/hooks/useConfirmPayment.js.map +1 -1
  69. package/lib/module/hooks/useConfirmSetupIntent.js +1 -1
  70. package/lib/module/hooks/useConfirmSetupIntent.js.map +1 -1
  71. package/lib/module/hooks/useFinancialConnectionsSheet.js +2 -0
  72. package/lib/module/hooks/useFinancialConnectionsSheet.js.map +1 -0
  73. package/lib/module/hooks/useGooglePay.js +1 -1
  74. package/lib/module/hooks/useGooglePay.js.map +1 -1
  75. package/lib/module/hooks/usePaymentSheet.js +1 -1
  76. package/lib/module/hooks/usePaymentSheet.js.map +1 -1
  77. package/lib/module/hooks/useStripe.js +1 -1
  78. package/lib/module/hooks/useStripe.js.map +1 -1
  79. package/lib/module/index.js +1 -1
  80. package/lib/module/index.js.map +1 -1
  81. package/lib/module/plugin/withStripe.js +1 -1
  82. package/lib/module/plugin/withStripe.js.map +1 -1
  83. package/lib/module/types/FinancialConnections.js +2 -0
  84. package/lib/module/types/FinancialConnections.js.map +1 -0
  85. package/lib/module/types/PaymentIntent.js.map +1 -1
  86. package/lib/module/types/SetupIntent.js.map +1 -1
  87. package/lib/module/types/index.js +1 -1
  88. package/lib/module/types/index.js.map +1 -1
  89. package/lib/typescript/src/NativeStripeSdk.d.ts +4 -2
  90. package/lib/typescript/src/functions.d.ts +24 -2
  91. package/lib/typescript/src/hooks/useConfirmPayment.d.ts +2 -2
  92. package/lib/typescript/src/hooks/useFinancialConnectionsSheet.d.ts +11 -0
  93. package/lib/typescript/src/hooks/useStripe.d.ts +4 -2
  94. package/lib/typescript/src/index.d.ts +1 -0
  95. package/lib/typescript/src/types/FinancialConnections.d.ts +100 -0
  96. package/lib/typescript/src/types/PaymentIntent.d.ts +1 -0
  97. package/lib/typescript/src/types/SetupIntent.d.ts +1 -0
  98. package/lib/typescript/src/types/Token.d.ts +18 -7
  99. package/lib/typescript/src/types/index.d.ts +2 -1
  100. package/package.json +10 -12
  101. package/src/NativeStripeSdk.tsx +10 -2
  102. package/src/functions.ts +67 -1
  103. package/src/hooks/useConfirmPayment.tsx +3 -3
  104. package/src/hooks/useFinancialConnectionsSheet.tsx +34 -0
  105. package/src/hooks/useStripe.tsx +24 -2
  106. package/src/index.tsx +1 -0
  107. package/src/types/FinancialConnections.ts +126 -0
  108. package/src/types/PaymentIntent.ts +1 -0
  109. package/src/types/SetupIntent.ts +1 -0
  110. package/src/types/Token.ts +24 -7
  111. package/src/types/index.ts +2 -0
  112. package/stripe-react-native.podspec +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["NativeStripeSdk.tsx"],"names":["StripeSdk","NativeModules"],"mappings":"gFAAA,yCAoGA,GAAQA,CAAAA,SAAR,CAAsBC,0BAAtB,CAAQD,SAAR,C,aAEeA,S","sourcesContent":["import { NativeModules } from 'react-native';\nimport type {\n PaymentMethod,\n ApplePay,\n PaymentSheet,\n SetupIntent,\n InitialiseParams,\n CreatePaymentMethodResult,\n RetrievePaymentIntentResult,\n RetrieveSetupIntentResult,\n ConfirmPaymentResult,\n HandleNextActionResult,\n ConfirmSetupIntentResult,\n CreateTokenForCVCUpdateResult,\n InitPaymentSheetResult,\n PresentPaymentSheetResult,\n ConfirmPaymentSheetPaymentResult,\n ApplePayResult,\n CreateTokenResult,\n GooglePayInitResult,\n PayWithGooglePayResult,\n CreateGooglePayPaymentMethodResult,\n GooglePay,\n OpenApplePaySetupResult,\n Token,\n VerifyMicrodepositsParams,\n IsCardInWalletResult,\n CanAddCardToWalletParams,\n CanAddCardToWalletResult,\n} from './types';\n\ntype NativeStripeSdkType = {\n initialise(params: InitialiseParams): Promise<void>;\n createPaymentMethod(\n params: PaymentMethod.CreateParams,\n options: PaymentMethod.CreateOptions\n ): Promise<CreatePaymentMethodResult>;\n handleNextAction(\n paymentIntentClientSecret: string\n ): Promise<HandleNextActionResult>;\n confirmPayment(\n paymentIntentClientSecret: string,\n params: PaymentMethod.ConfirmParams,\n options: PaymentMethod.ConfirmOptions\n ): Promise<ConfirmPaymentResult>;\n isApplePaySupported(): Promise<boolean>;\n presentApplePay(params: ApplePay.PresentParams): Promise<ApplePayResult>;\n confirmApplePayPayment(clientSecret: string): Promise<void>;\n updateApplePaySummaryItems(\n summaryItems: ApplePay.CartSummaryItem[],\n errorAddressFields: Array<{\n field: ApplePay.AddressFields;\n message?: string;\n }>\n ): Promise<void>;\n confirmSetupIntent(\n paymentIntentClientSecret: string,\n params: SetupIntent.ConfirmParams,\n options: SetupIntent.ConfirmOptions\n ): Promise<ConfirmSetupIntentResult>;\n retrievePaymentIntent(\n clientSecret: string\n ): Promise<RetrievePaymentIntentResult>;\n retrieveSetupIntent(clientSecret: string): Promise<RetrieveSetupIntentResult>;\n initPaymentSheet(\n params: PaymentSheet.SetupParams\n ): Promise<InitPaymentSheetResult>;\n presentPaymentSheet(): Promise<PresentPaymentSheetResult>;\n confirmPaymentSheetPayment(): Promise<ConfirmPaymentSheetPaymentResult>;\n createTokenForCVCUpdate(cvc: string): Promise<CreateTokenForCVCUpdateResult>;\n handleURLCallback(url: string): Promise<boolean>;\n createToken(params: Token.CreateParams): Promise<CreateTokenResult>;\n isGooglePaySupported(params: GooglePay.IsSupportedParams): Promise<boolean>;\n initGooglePay(params: GooglePay.InitParams): Promise<GooglePayInitResult>;\n presentGooglePay(\n params: GooglePay.PresentParams\n ): Promise<PayWithGooglePayResult>;\n createGooglePayPaymentMethod(\n params: GooglePay.CreatePaymentMethodParams\n ): Promise<CreateGooglePayPaymentMethodResult>;\n openApplePaySetup(): Promise<OpenApplePaySetupResult>;\n verifyMicrodeposits(\n isPaymentIntent: boolean,\n clientSecret: string,\n params: VerifyMicrodepositsParams\n ): Promise<ConfirmSetupIntentResult | ConfirmPaymentResult>;\n collectBankAccount(\n isPaymentIntent: boolean,\n clientSecret: string,\n params: PaymentMethod.CollectBankAccountParams\n ): Promise<ConfirmSetupIntentResult | ConfirmPaymentResult>;\n getConstants(): { API_VERSIONS: { CORE: string; ISSUING: string } };\n canAddCardToWallet(\n params: CanAddCardToWalletParams\n ): Promise<CanAddCardToWalletResult>;\n isCardInWallet(params: {\n cardLastFour: string;\n }): Promise<IsCardInWalletResult>;\n};\n\nconst { StripeSdk } = NativeModules;\n\nexport default StripeSdk as NativeStripeSdkType;\n"]}
1
+ {"version":3,"sources":["NativeStripeSdk.tsx"],"names":["StripeSdk","NativeModules"],"mappings":"gFAAA,yCA4GA,GAAQA,CAAAA,SAAR,CAAsBC,0BAAtB,CAAQD,SAAR,C,aAEeA,S","sourcesContent":["import { NativeModules } from 'react-native';\nimport type {\n PaymentMethod,\n PaymentIntent,\n ApplePay,\n PaymentSheet,\n SetupIntent,\n InitialiseParams,\n CreatePaymentMethodResult,\n RetrievePaymentIntentResult,\n RetrieveSetupIntentResult,\n ConfirmPaymentResult,\n HandleNextActionResult,\n ConfirmSetupIntentResult,\n CreateTokenForCVCUpdateResult,\n InitPaymentSheetResult,\n PresentPaymentSheetResult,\n ConfirmPaymentSheetPaymentResult,\n ApplePayResult,\n CreateTokenResult,\n GooglePayInitResult,\n PayWithGooglePayResult,\n CreateGooglePayPaymentMethodResult,\n GooglePay,\n OpenApplePaySetupResult,\n Token,\n VerifyMicrodepositsParams,\n IsCardInWalletResult,\n CanAddCardToWalletParams,\n CanAddCardToWalletResult,\n FinancialConnections,\n} from './types';\n\ntype NativeStripeSdkType = {\n initialise(params: InitialiseParams): Promise<void>;\n createPaymentMethod(\n params: PaymentMethod.CreateParams,\n options: PaymentMethod.CreateOptions\n ): Promise<CreatePaymentMethodResult>;\n handleNextAction(\n paymentIntentClientSecret: string\n ): Promise<HandleNextActionResult>;\n confirmPayment(\n paymentIntentClientSecret: string,\n params?: PaymentIntent.ConfirmParams,\n options?: PaymentIntent.ConfirmOptions\n ): Promise<ConfirmPaymentResult>;\n isApplePaySupported(): Promise<boolean>;\n presentApplePay(params: ApplePay.PresentParams): Promise<ApplePayResult>;\n confirmApplePayPayment(clientSecret: string): Promise<void>;\n updateApplePaySummaryItems(\n summaryItems: ApplePay.CartSummaryItem[],\n errorAddressFields: Array<{\n field: ApplePay.AddressFields;\n message?: string;\n }>\n ): Promise<void>;\n confirmSetupIntent(\n paymentIntentClientSecret: string,\n params: SetupIntent.ConfirmParams,\n options: SetupIntent.ConfirmOptions\n ): Promise<ConfirmSetupIntentResult>;\n retrievePaymentIntent(\n clientSecret: string\n ): Promise<RetrievePaymentIntentResult>;\n retrieveSetupIntent(clientSecret: string): Promise<RetrieveSetupIntentResult>;\n initPaymentSheet(\n params: PaymentSheet.SetupParams\n ): Promise<InitPaymentSheetResult>;\n presentPaymentSheet(): Promise<PresentPaymentSheetResult>;\n confirmPaymentSheetPayment(): Promise<ConfirmPaymentSheetPaymentResult>;\n createTokenForCVCUpdate(cvc: string): Promise<CreateTokenForCVCUpdateResult>;\n handleURLCallback(url: string): Promise<boolean>;\n createToken(params: Token.CreateParams): Promise<CreateTokenResult>;\n isGooglePaySupported(params: GooglePay.IsSupportedParams): Promise<boolean>;\n initGooglePay(params: GooglePay.InitParams): Promise<GooglePayInitResult>;\n presentGooglePay(\n params: GooglePay.PresentParams\n ): Promise<PayWithGooglePayResult>;\n createGooglePayPaymentMethod(\n params: GooglePay.CreatePaymentMethodParams\n ): Promise<CreateGooglePayPaymentMethodResult>;\n openApplePaySetup(): Promise<OpenApplePaySetupResult>;\n verifyMicrodeposits(\n isPaymentIntent: boolean,\n clientSecret: string,\n params: VerifyMicrodepositsParams\n ): Promise<ConfirmSetupIntentResult | ConfirmPaymentResult>;\n collectBankAccount(\n isPaymentIntent: boolean,\n clientSecret: string,\n params: PaymentMethod.CollectBankAccountParams\n ): Promise<ConfirmSetupIntentResult | ConfirmPaymentResult>;\n getConstants(): { API_VERSIONS: { CORE: string; ISSUING: string } };\n canAddCardToWallet(\n params: CanAddCardToWalletParams\n ): Promise<CanAddCardToWalletResult>;\n isCardInWallet(params: {\n cardLastFour: string;\n }): Promise<IsCardInWalletResult>;\n collectBankAccountToken(\n clientSecret: string\n ): Promise<FinancialConnections.TokenResult>;\n collectFinancialConnectionsAccounts(\n clientSecret: string\n ): Promise<FinancialConnections.SessionResult>;\n};\n\nconst { StripeSdk } = NativeModules;\n\nexport default StripeSdk as NativeStripeSdkType;\n"]}
@@ -1,2 +1,2 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.AuBECSDebitForm=AuBECSDebitForm;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _jsxFileName="/Users/charliecruzan/stripe/stripe-react-native/src/components/AuBECSDebitForm.tsx";var _excluded=["onComplete","companyName","formStyle"];var AuBECSDebitFormNative=(0,_reactNative.requireNativeComponent)('AuBECSDebitForm');function AuBECSDebitForm(_ref){var onComplete=_ref.onComplete,companyName=_ref.companyName,formStyle=_ref.formStyle,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);return _react.default.createElement(AuBECSDebitFormNative,(0,_extends2.default)({onCompleteAction:function onCompleteAction(value){return onComplete(value.nativeEvent);},companyName:companyName,formStyle:(0,_extends2.default)({},formStyle)},props,{__self:this,__source:{fileName:_jsxFileName,lineNumber:48,columnNumber:5}}));}
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.AuBECSDebitForm=AuBECSDebitForm;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _jsxFileName="/Users/charliecruzan/stripe/stripe-react-native/src/components/AuBECSDebitForm.tsx";var _excluded=["onComplete","companyName","formStyle"];var AuBECSDebitFormNative=(0,_reactNative.requireNativeComponent)('AuBECSDebitForm');function AuBECSDebitForm(_ref){var onComplete=_ref.onComplete,companyName=_ref.companyName,formStyle=_ref.formStyle,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);return _react.default.createElement(AuBECSDebitFormNative,(0,_extends2.default)({onCompleteAction:function onCompleteAction(value){return onComplete(value.nativeEvent);},companyName:companyName,formStyle:Object.assign({},formStyle)},props,{__self:this,__source:{fileName:_jsxFileName,lineNumber:48,columnNumber:5}}));}
2
2
  //# sourceMappingURL=AuBECSDebitForm.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["AuBECSDebitForm.tsx"],"names":["AuBECSDebitFormNative","AuBECSDebitForm","onComplete","companyName","formStyle","props","value","nativeEvent"],"mappings":"oXAAA,oDACA,yC,6JAQA,GAAMA,CAAAA,qBAAqB,CACzB,wCACE,iBADF,CADF,CA+BO,QAASC,CAAAA,eAAT,MAKG,IAJRC,CAAAA,UAIQ,MAJRA,UAIQ,CAHRC,WAGQ,MAHRA,WAGQ,CAFRC,SAEQ,MAFRA,SAEQ,CADLC,KACK,uDACR,MACE,8BAAC,qBAAD,wBACE,gBAAgB,CAAE,0BAACC,KAAD,QAAWJ,CAAAA,UAAU,CAACI,KAAK,CAACC,WAAP,CAArB,EADpB,CAEE,WAAW,CAAEJ,WAFf,CAGE,SAAS,0BAAOC,SAAP,CAHX,EAIMC,KAJN,8EADF,CAQD","sourcesContent":["import React from 'react';\nimport {\n AccessibilityProps,\n requireNativeComponent,\n StyleProp,\n ViewStyle,\n} from 'react-native';\nimport type { AuBECSDebitFormComponent } from '../types';\n\nconst AuBECSDebitFormNative =\n requireNativeComponent<AuBECSDebitFormComponent.NativeProps>(\n 'AuBECSDebitForm'\n );\n\n/**\n * BECS Debit Form Component Props\n */\nexport interface Props extends AccessibilityProps {\n companyName: string;\n onComplete(value: AuBECSDebitFormComponent.FormDetails): void;\n formStyle?: AuBECSDebitFormComponent.Styles;\n style?: StyleProp<ViewStyle>;\n testID?: string;\n}\n\n/**\n * BECS Debit form component\n *\n * @example\n * ```ts\n * <AuBECSDebitForm\n * companyName=\"Example Company Inc.\"\n * onComplete={value => onComplete(value)}\n * style={{ width: '100%', height: 500 }}\n * />\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport function AuBECSDebitForm({\n onComplete,\n companyName,\n formStyle,\n ...props\n}: Props) {\n return (\n <AuBECSDebitFormNative\n onCompleteAction={(value) => onComplete(value.nativeEvent)}\n companyName={companyName}\n formStyle={{ ...formStyle }}\n {...props}\n />\n );\n}\n"]}
1
+ {"version":3,"sources":["AuBECSDebitForm.tsx"],"names":["AuBECSDebitFormNative","AuBECSDebitForm","onComplete","companyName","formStyle","props","value","nativeEvent"],"mappings":"oXAAA,oDACA,yC,6JAQA,GAAMA,CAAAA,qBAAqB,CACzB,wCACE,iBADF,CADF,CA+BO,QAASC,CAAAA,eAAT,MAKG,IAJRC,CAAAA,UAIQ,MAJRA,UAIQ,CAHRC,WAGQ,MAHRA,WAGQ,CAFRC,SAEQ,MAFRA,SAEQ,CADLC,KACK,uDACR,MACE,8BAAC,qBAAD,wBACE,gBAAgB,CAAE,0BAACC,KAAD,QAAWJ,CAAAA,UAAU,CAACI,KAAK,CAACC,WAAP,CAArB,EADpB,CAEE,WAAW,CAAEJ,WAFf,CAGE,SAAS,kBAAOC,SAAP,CAHX,EAIMC,KAJN,8EADF,CAQD","sourcesContent":["import React from 'react';\nimport {\n AccessibilityProps,\n requireNativeComponent,\n StyleProp,\n ViewStyle,\n} from 'react-native';\nimport type { AuBECSDebitFormComponent } from '../types';\n\nconst AuBECSDebitFormNative =\n requireNativeComponent<AuBECSDebitFormComponent.NativeProps>(\n 'AuBECSDebitForm'\n );\n\n/**\n * BECS Debit Form Component Props\n */\nexport interface Props extends AccessibilityProps {\n companyName: string;\n onComplete(value: AuBECSDebitFormComponent.FormDetails): void;\n formStyle?: AuBECSDebitFormComponent.Styles;\n style?: StyleProp<ViewStyle>;\n testID?: string;\n}\n\n/**\n * BECS Debit form component\n *\n * @example\n * ```ts\n * <AuBECSDebitForm\n * companyName=\"Example Company Inc.\"\n * onComplete={value => onComplete(value)}\n * style={{ width: '100%', height: 500 }}\n * />\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport function AuBECSDebitForm({\n onComplete,\n companyName,\n formStyle,\n ...props\n}: Props) {\n return (\n <AuBECSDebitFormNative\n onCompleteAction={(value) => onComplete(value.nativeEvent)}\n companyName={companyName}\n formStyle={{ ...formStyle }}\n {...props}\n />\n );\n}\n"]}
@@ -1,2 +1,2 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.CardForm=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _helpers=require("../helpers");var _excluded=["onFormComplete","cardStyle","placeholders","defaultValues"];var _this=this,_jsxFileName="/Users/charliecruzan/stripe/stripe-react-native/src/components/CardForm.tsx";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var CardFormNative=(0,_reactNative.requireNativeComponent)('CardForm');var CardForm=(0,_react.forwardRef)(function(_ref,ref){var onFormComplete=_ref.onFormComplete,cardStyle=_ref.cardStyle,placeholders=_ref.placeholders,defaultValues=_ref.defaultValues,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);var inputRef=(0,_react.useRef)(null);var onFormCompleteHandler=(0,_react.useCallback)(function(event){var card=event.nativeEvent;var data={last4:card.last4,expiryMonth:card.expiryMonth,expiryYear:card.expiryYear,complete:card.complete,brand:card.brand,country:card.country,postalCode:card.postalCode};if(card.hasOwnProperty('number')||card.hasOwnProperty('cvc')){data.number=card.number||'';data.cvc=card.cvc||'';if(__DEV__&&onFormComplete&&card.complete){console.warn("[stripe-react-native] \u26A0\uFE0F WARNING: You've enabled `dangerouslyGetFullCardDetails`, meaning full card details are being returned. Only do this if you're certain that you fulfill the necessary PCI compliance requirements. Make sure that you're not mistakenly logging or storing full card details! See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance");}}onFormComplete==null?void 0:onFormComplete(data);},[onFormComplete]);var focus=function focus(){_reactNative.UIManager.dispatchViewManagerCommand((0,_reactNative.findNodeHandle)(inputRef.current),'focus',[]);};var blur=function blur(){_reactNative.UIManager.dispatchViewManagerCommand((0,_reactNative.findNodeHandle)(inputRef.current),'blur',[]);};(0,_react.useImperativeHandle)(ref,function(){return{focus:focus,blur:blur};});var onFocusHandler=(0,_react.useCallback)(function(event){var focusedField=event.nativeEvent.focusedField;if(focusedField){(0,_helpers.focusInput)(inputRef.current);}else{}},[]);(0,_react.useLayoutEffect)(function(){var inputRefValue=inputRef.current;if(inputRefValue!==null){(0,_helpers.registerInput)(inputRefValue);return function(){(0,_helpers.unregisterInput)(inputRefValue);if((0,_helpers.currentlyFocusedInput)()===inputRefValue){inputRefValue.blur();}};}return function(){};},[inputRef]);return _react.default.createElement(CardFormNative,(0,_extends2.default)({ref:inputRef,onFormComplete:onFormCompleteHandler,cardStyle:{backgroundColor:cardStyle==null?void 0:cardStyle.backgroundColor,borderColor:cardStyle==null?void 0:cardStyle.borderColor,borderWidth:cardStyle==null?void 0:cardStyle.borderWidth,borderRadius:cardStyle==null?void 0:cardStyle.borderRadius,cursorColor:cardStyle==null?void 0:cardStyle.cursorColor,fontSize:cardStyle==null?void 0:cardStyle.fontSize,placeholderColor:cardStyle==null?void 0:cardStyle.placeholderColor,textColor:cardStyle==null?void 0:cardStyle.textColor,textErrorColor:cardStyle==null?void 0:cardStyle.textErrorColor,fontFamily:cardStyle==null?void 0:cardStyle.fontFamily},placeholders:{number:placeholders==null?void 0:placeholders.number,expiration:placeholders==null?void 0:placeholders.expiration,cvc:placeholders==null?void 0:placeholders.cvc,postalCode:placeholders==null?void 0:placeholders.postalCode},defaultValues:(0,_extends2.default)({},defaultValues!=null?defaultValues:{}),onFocusChange:onFocusHandler},props,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:167,columnNumber:7}}));});exports.CardForm=CardForm;
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.CardForm=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _helpers=require("../helpers");var _excluded=["onFormComplete","cardStyle","placeholders","defaultValues"];var _this=this,_jsxFileName="/Users/charliecruzan/stripe/stripe-react-native/src/components/CardForm.tsx";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var CardFormNative=(0,_reactNative.requireNativeComponent)('CardForm');var CardForm=(0,_react.forwardRef)(function(_ref,ref){var onFormComplete=_ref.onFormComplete,cardStyle=_ref.cardStyle,placeholders=_ref.placeholders,defaultValues=_ref.defaultValues,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);var inputRef=(0,_react.useRef)(null);var onFormCompleteHandler=(0,_react.useCallback)(function(event){var card=event.nativeEvent;var data={last4:card.last4,expiryMonth:card.expiryMonth,expiryYear:card.expiryYear,complete:card.complete,brand:card.brand,country:card.country,postalCode:card.postalCode};if(card.hasOwnProperty('number')||card.hasOwnProperty('cvc')){data.number=card.number||'';data.cvc=card.cvc||'';if(__DEV__&&onFormComplete&&card.complete){console.warn("[stripe-react-native] \u26A0\uFE0F WARNING: You've enabled `dangerouslyGetFullCardDetails`, meaning full card details are being returned. Only do this if you're certain that you fulfill the necessary PCI compliance requirements. Make sure that you're not mistakenly logging or storing full card details! See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance");}}onFormComplete==null?void 0:onFormComplete(data);},[onFormComplete]);var focus=function focus(){_reactNative.UIManager.dispatchViewManagerCommand((0,_reactNative.findNodeHandle)(inputRef.current),'focus',[]);};var blur=function blur(){_reactNative.UIManager.dispatchViewManagerCommand((0,_reactNative.findNodeHandle)(inputRef.current),'blur',[]);};(0,_react.useImperativeHandle)(ref,function(){return{focus:focus,blur:blur};});var onFocusHandler=(0,_react.useCallback)(function(event){var focusedField=event.nativeEvent.focusedField;if(focusedField){(0,_helpers.focusInput)(inputRef.current);}else{}},[]);(0,_react.useLayoutEffect)(function(){var inputRefValue=inputRef.current;if(inputRefValue!==null){(0,_helpers.registerInput)(inputRefValue);return function(){(0,_helpers.unregisterInput)(inputRefValue);if((0,_helpers.currentlyFocusedInput)()===inputRefValue){inputRefValue.blur();}};}return function(){};},[inputRef]);return _react.default.createElement(CardFormNative,(0,_extends2.default)({ref:inputRef,onFormComplete:onFormCompleteHandler,cardStyle:{backgroundColor:cardStyle==null?void 0:cardStyle.backgroundColor,borderColor:cardStyle==null?void 0:cardStyle.borderColor,borderWidth:cardStyle==null?void 0:cardStyle.borderWidth,borderRadius:cardStyle==null?void 0:cardStyle.borderRadius,cursorColor:cardStyle==null?void 0:cardStyle.cursorColor,fontSize:cardStyle==null?void 0:cardStyle.fontSize,placeholderColor:cardStyle==null?void 0:cardStyle.placeholderColor,textColor:cardStyle==null?void 0:cardStyle.textColor,textErrorColor:cardStyle==null?void 0:cardStyle.textErrorColor,fontFamily:cardStyle==null?void 0:cardStyle.fontFamily},placeholders:{number:placeholders==null?void 0:placeholders.number,expiration:placeholders==null?void 0:placeholders.expiration,cvc:placeholders==null?void 0:placeholders.cvc,postalCode:placeholders==null?void 0:placeholders.postalCode},defaultValues:Object.assign({},defaultValues!=null?defaultValues:{}),onFocusChange:onFocusHandler},props,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:167,columnNumber:7}}));});exports.CardForm=CardForm;
2
2
  //# sourceMappingURL=CardForm.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["CardForm.tsx"],"names":["CardFormNative","CardForm","ref","onFormComplete","cardStyle","placeholders","defaultValues","props","inputRef","onFormCompleteHandler","event","card","nativeEvent","data","last4","expiryMonth","expiryYear","complete","brand","country","postalCode","hasOwnProperty","number","cvc","__DEV__","console","warn","focus","UIManager","dispatchViewManagerCommand","current","blur","onFocusHandler","focusedField","inputRefValue","backgroundColor","borderColor","borderWidth","borderRadius","cursorColor","fontSize","placeholderColor","textColor","textErrorColor","fontFamily","expiration"],"mappings":"oWACA,qDAOA,yCASA,mC,grCAOA,GAAMA,CAAAA,cAAc,CAClB,wCAAiD,UAAjD,CADF,CAmDO,GAAMC,CAAAA,QAAQ,CAAG,sBACtB,cAYEC,GAZF,CAaK,IAXDC,CAAAA,cAWC,MAXDA,cAWC,CAVDC,SAUC,MAVDA,SAUC,CALDC,YAKC,MALDA,YAKC,CAJDC,aAIC,MAJDA,aAIC,CAHEC,KAGF,uDACH,GAAMC,CAAAA,QAAQ,CAAG,kBAAY,IAAZ,CAAjB,CAEA,GAAMC,CAAAA,qBAAqB,CAAG,uBAC5B,SAACC,KAAD,CAAuD,CACrD,GAAMC,CAAAA,IAAI,CAAGD,KAAK,CAACE,WAAnB,CAEA,GAAMC,CAAAA,IAA0B,CAAG,CACjCC,KAAK,CAAEH,IAAI,CAACG,KADqB,CAEjCC,WAAW,CAAEJ,IAAI,CAACI,WAFe,CAGjCC,UAAU,CAAEL,IAAI,CAACK,UAHgB,CAIjCC,QAAQ,CAAEN,IAAI,CAACM,QAJkB,CAKjCC,KAAK,CAAEP,IAAI,CAACO,KALqB,CAMjCC,OAAO,CAAER,IAAI,CAACQ,OANmB,CAOjCC,UAAU,CAAET,IAAI,CAACS,UAPgB,CAAnC,CAUA,GAAIT,IAAI,CAACU,cAAL,CAAoB,QAApB,GAAiCV,IAAI,CAACU,cAAL,CAAoB,KAApB,CAArC,CAAiE,CAC/DR,IAAI,CAACS,MAAL,CAAcX,IAAI,CAACW,MAAL,EAAe,EAA7B,CACAT,IAAI,CAACU,GAAL,CAAWZ,IAAI,CAACY,GAAL,EAAY,EAAvB,CACA,GAAIC,OAAO,EAAIrB,cAAX,EAA6BQ,IAAI,CAACM,QAAtC,CAAgD,CAC9CQ,OAAO,CAACC,IAAR,+YAGD,CACF,CACDvB,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nB,CAETC,WAAW,CAAEhC,SAAF,cAAEA,SAAS,CAAEgC,WAFf,CAGTC,WAAW,CAAEjC,SAAF,cAAEA,SAAS,CAAEiC,WAHf,CAITC,YAAY,CAAElC,SAAF,cAAEA,SAAS,CAAEkC,YAJhB,CAKTC,WAAW,CAAEnC,SAAF,cAAEA,SAAS,CAAEmC,WALf,CAMTC,QAAQ,CAAEpC,SAAF,cAAEA,SAAS,CAAEoC,QANZ,CAOTC,gBAAgB,CAAErC,SAAF,cAAEA,SAAS,CAAEqC,gBAPpB,CAQTC,SAAS,CAAEtC,SAAF,cAAEA,SAAS,CAAEsC,SARb,CASTC,cAAc,CAAEvC,SAAF,cAAEA,SAAS,CAAEuC,cATlB,CAUTC,UAAU,CAAExC,SAAF,cAAEA,SAAS,CAAEwC,UAVd,CAHb,CAkBE,YAAY,CAAE,CACZtB,MAAM,CAAEjB,YAAF,cAAEA,YAAY,CAAEiB,MADV,CAEZuB,UAAU,CAAExC,YAAF,cAAEA,YAAY,CAAEwC,UAFd,CAGZtB,GAAG,CAAElB,YAAF,cAAEA,YAAY,CAAEkB,GAHP,CAIZH,UAAU,CAAEf,YAAF,cAAEA,YAAY,CAAEe,UAJd,CAlBhB,CAwBE,aAAa,0BACPd,aADO,OACPA,aADO,CACU,EADV,CAxBf,CA2BE,aAAa,CAAE0B,cA3BjB,EA6BMzB,KA7BN,gFADF,CAiCD,CA3HqB,CAAjB,C","sourcesContent":["import type { CardFormView } from '../types';\nimport React, {\n forwardRef,\n useCallback,\n useImperativeHandle,\n useLayoutEffect,\n useRef,\n} from 'react';\nimport {\n AccessibilityProps,\n NativeSyntheticEvent,\n requireNativeComponent,\n UIManager,\n StyleProp,\n findNodeHandle,\n ViewStyle,\n} from 'react-native';\nimport {\n currentlyFocusedInput,\n focusInput,\n registerInput,\n unregisterInput,\n} from '../helpers';\n\nconst CardFormNative =\n requireNativeComponent<CardFormView.NativeProps>('CardForm');\n\n/**\n * Card Form Component Props\n */\nexport interface Props extends AccessibilityProps {\n style?: StyleProp<ViewStyle>;\n autofocus?: boolean;\n testID?: string;\n\n /** All styles except backgroundColor, cursorColor, borderColor, and borderRadius are Android only */\n cardStyle?: CardFormView.Styles;\n // isUserInteractionEnabled?: boolean;\n\n // TODO: will make it public when iOS SDK allows for this\n // postalCodeEnabled?: boolean;\n\n /** Android only */\n placeholders?: CardFormView.Placeholders;\n /** Android only */\n defaultValues?: CardFormView.DefaultValues;\n // onBlur?(): void;\n // onFocus?(focusedField: CardFormView.FieldNames | null): void;\n onFormComplete?(card: CardFormView.Details): void;\n /**\n * WARNING: If set to `true` the full card number will be returned in the `onFormComplete` handler.\n * Only do this if you're certain that you fulfill the necessary PCI compliance requirements.\n * Make sure that you're not mistakenly logging or storing full card details!\n * See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance\n */\n dangerouslyGetFullCardDetails?: boolean;\n}\n\n/**\n * Card Form Component\n *\n * @example\n * ```ts\n * <CardForm\n * onFormComplete={(cardDetails) => {\n * console.log('card details', cardDetails);\n * setCard(cardDetails);\n * }}\n * style={{height: 200}}\n * />\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport const CardForm = forwardRef<CardFormView.Methods, Props>(\n (\n {\n onFormComplete,\n cardStyle,\n // isUserInteractionEnabled = true,\n // postalCodeEnabled = true,\n // onFocus,\n // onBlur,\n placeholders,\n defaultValues,\n ...props\n },\n ref\n ) => {\n const inputRef = useRef<any>(null);\n\n const onFormCompleteHandler = useCallback(\n (event: NativeSyntheticEvent<CardFormView.Details>) => {\n const card = event.nativeEvent;\n\n const data: CardFormView.Details = {\n last4: card.last4,\n expiryMonth: card.expiryMonth,\n expiryYear: card.expiryYear,\n complete: card.complete,\n brand: card.brand,\n country: card.country,\n postalCode: card.postalCode,\n };\n\n if (card.hasOwnProperty('number') || card.hasOwnProperty('cvc')) {\n data.number = card.number || '';\n data.cvc = card.cvc || '';\n if (__DEV__ && onFormComplete && card.complete) {\n console.warn(\n `[stripe-react-native] ⚠️ WARNING: You've enabled \\`dangerouslyGetFullCardDetails\\`, meaning full card details are being returned. Only do this if you're certain that you fulfill the necessary PCI compliance requirements. Make sure that you're not mistakenly logging or storing full card details! See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance`\n );\n }\n }\n onFormComplete?.(data);\n },\n [onFormComplete]\n );\n\n const focus = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(inputRef.current),\n 'focus' as any,\n []\n );\n };\n\n const blur = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(inputRef.current),\n 'blur' as any,\n []\n );\n };\n\n useImperativeHandle(ref, () => ({\n focus,\n blur,\n }));\n\n const onFocusHandler = useCallback((event) => {\n const { focusedField } = event.nativeEvent;\n if (focusedField) {\n focusInput(inputRef.current);\n // onFocus?.(focusedField);\n } else {\n // onBlur?.();\n }\n }, []);\n\n useLayoutEffect(() => {\n const inputRefValue = inputRef.current;\n if (inputRefValue !== null) {\n registerInput(inputRefValue);\n return () => {\n unregisterInput(inputRefValue);\n if (currentlyFocusedInput() === inputRefValue) {\n inputRefValue.blur();\n }\n };\n }\n return () => {};\n }, [inputRef]);\n\n return (\n <CardFormNative\n ref={inputRef}\n onFormComplete={onFormCompleteHandler}\n cardStyle={{\n backgroundColor: cardStyle?.backgroundColor,\n borderColor: cardStyle?.borderColor,\n borderWidth: cardStyle?.borderWidth,\n borderRadius: cardStyle?.borderRadius,\n cursorColor: cardStyle?.cursorColor,\n fontSize: cardStyle?.fontSize,\n placeholderColor: cardStyle?.placeholderColor,\n textColor: cardStyle?.textColor,\n textErrorColor: cardStyle?.textErrorColor,\n fontFamily: cardStyle?.fontFamily,\n // disabledBackgroundColor: cardStyle?.disabledBackgroundColor,\n // type: cardStyle?.type,\n }}\n // isUserInteractionEnabledValue={isUserInteractionEnabled}\n placeholders={{\n number: placeholders?.number,\n expiration: placeholders?.expiration,\n cvc: placeholders?.cvc,\n postalCode: placeholders?.postalCode,\n }}\n defaultValues={{\n ...(defaultValues ?? {}),\n }}\n onFocusChange={onFocusHandler}\n // postalCodeEnabled={postalCodeEnabled}\n {...props}\n />\n );\n }\n);\n"]}
1
+ {"version":3,"sources":["CardForm.tsx"],"names":["CardFormNative","CardForm","ref","onFormComplete","cardStyle","placeholders","defaultValues","props","inputRef","onFormCompleteHandler","event","card","nativeEvent","data","last4","expiryMonth","expiryYear","complete","brand","country","postalCode","hasOwnProperty","number","cvc","__DEV__","console","warn","focus","UIManager","dispatchViewManagerCommand","current","blur","onFocusHandler","focusedField","inputRefValue","backgroundColor","borderColor","borderWidth","borderRadius","cursorColor","fontSize","placeholderColor","textColor","textErrorColor","fontFamily","expiration"],"mappings":"oWACA,qDAOA,yCASA,mC,grCAOA,GAAMA,CAAAA,cAAc,CAClB,wCAAiD,UAAjD,CADF,CAmDO,GAAMC,CAAAA,QAAQ,CAAG,sBACtB,cAYEC,GAZF,CAaK,IAXDC,CAAAA,cAWC,MAXDA,cAWC,CAVDC,SAUC,MAVDA,SAUC,CALDC,YAKC,MALDA,YAKC,CAJDC,aAIC,MAJDA,aAIC,CAHEC,KAGF,uDACH,GAAMC,CAAAA,QAAQ,CAAG,kBAAY,IAAZ,CAAjB,CAEA,GAAMC,CAAAA,qBAAqB,CAAG,uBAC5B,SAACC,KAAD,CAAuD,CACrD,GAAMC,CAAAA,IAAI,CAAGD,KAAK,CAACE,WAAnB,CAEA,GAAMC,CAAAA,IAA0B,CAAG,CACjCC,KAAK,CAAEH,IAAI,CAACG,KADqB,CAEjCC,WAAW,CAAEJ,IAAI,CAACI,WAFe,CAGjCC,UAAU,CAAEL,IAAI,CAACK,UAHgB,CAIjCC,QAAQ,CAAEN,IAAI,CAACM,QAJkB,CAKjCC,KAAK,CAAEP,IAAI,CAACO,KALqB,CAMjCC,OAAO,CAAER,IAAI,CAACQ,OANmB,CAOjCC,UAAU,CAAET,IAAI,CAACS,UAPgB,CAAnC,CAUA,GAAIT,IAAI,CAACU,cAAL,CAAoB,QAApB,GAAiCV,IA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AAI,uCAA4BA,aAAhC,CAA+C,CAC7CA,aAAa,CAACH,IAAd,GACD,CACF,CALD,CAMD,CACD,MAAO,WAAM,CAAE,CAAf,CACD,CAZD,CAYG,CAACvB,QAAD,CAZH,EAcA,MACE,8BAAC,cAAD,wBACE,GAAG,CAAEA,QADP,CAEE,cAAc,CAAEC,qBAFlB,CAGE,SAAS,CAAE,CACT0B,eAAe,CAAE/B,SAAF,cAAEA,SAAS,CAAE+B,eADnB,CAETC,WAAW,CAAEhC,SAAF,cAAEA,SAAS,CAAEgC,WAFf,CAGTC,WAAW,CAAEjC,SAAF,cAAEA,SAAS,CAAEiC,WAHf,CAITC,YAAY,CAAElC,SAAF,cAAEA,SAAS,CAAEkC,YAJhB,CAKTC,WAAW,CAAEnC,SAAF,cAAEA,SAAS,CAAEmC,WALf,CAMTC,QAAQ,CAAEpC,SAAF,cAAEA,SAAS,CAAEoC,QANZ,CAOTC,gBAAgB,CAAErC,SAAF,cAAEA,SAAS,CAAEqC,gBAPpB,CAQTC,SAAS,CAAEtC,SAAF,cAAEA,SAAS,CAAEsC,SARb,CASTC,cAAc,CAAEvC,SAAF,cAAEA,SAAS,CAAEuC,cATlB,CAUTC,UAAU,CAAExC,SAAF,cAAEA,SAAS,CAAEwC,UAVd,CAHb,CAkBE,YAAY,CAAE,CACZtB,MAAM,CAAEjB,YAAF,cAAEA,YAAY,CAAEiB,MADV,CAEZuB,UAAU,CAAExC,YAAF,cAAEA,YAAY,CAAEwC,UAFd,CAGZtB,GAAG,CAAElB,YAAF,cAAEA,YAAY,CAAEkB,GAHP,CAIZH,UAAU,CAAEf,YAAF,cAAEA,YAAY,CAAEe,UAJd,CAlBhB,CAwBE,aAAa,kBACPd,aADO,OACPA,aADO,CACU,EADV,CAxBf,CA2BE,aAAa,CAAE0B,cA3BjB,EA6BMzB,KA7BN,gFADF,CAiCD,CA3HqB,CAAjB,C","sourcesContent":["import type { CardFormView } from '../types';\nimport React, {\n forwardRef,\n useCallback,\n useImperativeHandle,\n useLayoutEffect,\n useRef,\n} from 'react';\nimport {\n AccessibilityProps,\n NativeSyntheticEvent,\n requireNativeComponent,\n UIManager,\n StyleProp,\n findNodeHandle,\n ViewStyle,\n} from 'react-native';\nimport {\n currentlyFocusedInput,\n focusInput,\n registerInput,\n unregisterInput,\n} from '../helpers';\n\nconst CardFormNative =\n requireNativeComponent<CardFormView.NativeProps>('CardForm');\n\n/**\n * Card Form Component Props\n */\nexport interface Props extends AccessibilityProps {\n style?: StyleProp<ViewStyle>;\n autofocus?: boolean;\n testID?: string;\n\n /** All styles except backgroundColor, cursorColor, borderColor, and borderRadius are Android only */\n cardStyle?: CardFormView.Styles;\n // isUserInteractionEnabled?: boolean;\n\n // TODO: will make it public when iOS SDK allows for this\n // postalCodeEnabled?: boolean;\n\n /** Android only */\n placeholders?: CardFormView.Placeholders;\n /** Android only */\n defaultValues?: CardFormView.DefaultValues;\n // onBlur?(): void;\n // onFocus?(focusedField: CardFormView.FieldNames | null): void;\n onFormComplete?(card: CardFormView.Details): void;\n /**\n * WARNING: If set to `true` the full card number will be returned in the `onFormComplete` handler.\n * Only do this if you're certain that you fulfill the necessary PCI compliance requirements.\n * Make sure that you're not mistakenly logging or storing full card details!\n * See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance\n */\n dangerouslyGetFullCardDetails?: boolean;\n}\n\n/**\n * Card Form Component\n *\n * @example\n * ```ts\n * <CardForm\n * onFormComplete={(cardDetails) => {\n * console.log('card details', cardDetails);\n * setCard(cardDetails);\n * }}\n * style={{height: 200}}\n * />\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport const CardForm = forwardRef<CardFormView.Methods, Props>(\n (\n {\n onFormComplete,\n cardStyle,\n // isUserInteractionEnabled = true,\n // postalCodeEnabled = true,\n // onFocus,\n // onBlur,\n placeholders,\n defaultValues,\n ...props\n },\n ref\n ) => {\n const inputRef = useRef<any>(null);\n\n const onFormCompleteHandler = useCallback(\n (event: NativeSyntheticEvent<CardFormView.Details>) => {\n const card = event.nativeEvent;\n\n const data: CardFormView.Details = {\n last4: card.last4,\n expiryMonth: card.expiryMonth,\n expiryYear: card.expiryYear,\n complete: card.complete,\n brand: card.brand,\n country: card.country,\n postalCode: card.postalCode,\n };\n\n if (card.hasOwnProperty('number') || card.hasOwnProperty('cvc')) {\n data.number = card.number || '';\n data.cvc = card.cvc || '';\n if (__DEV__ && onFormComplete && card.complete) {\n console.warn(\n `[stripe-react-native] ⚠️ WARNING: You've enabled \\`dangerouslyGetFullCardDetails\\`, meaning full card details are being returned. Only do this if you're certain that you fulfill the necessary PCI compliance requirements. Make sure that you're not mistakenly logging or storing full card details! See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance`\n );\n }\n }\n onFormComplete?.(data);\n },\n [onFormComplete]\n );\n\n const focus = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(inputRef.current),\n 'focus' as any,\n []\n );\n };\n\n const blur = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(inputRef.current),\n 'blur' as any,\n []\n );\n };\n\n useImperativeHandle(ref, () => ({\n focus,\n blur,\n }));\n\n const onFocusHandler = useCallback((event) => {\n const { focusedField } = event.nativeEvent;\n if (focusedField) {\n focusInput(inputRef.current);\n // onFocus?.(focusedField);\n } else {\n // onBlur?.();\n }\n }, []);\n\n useLayoutEffect(() => {\n const inputRefValue = inputRef.current;\n if (inputRefValue !== null) {\n registerInput(inputRefValue);\n return () => {\n unregisterInput(inputRefValue);\n if (currentlyFocusedInput() === inputRefValue) {\n inputRefValue.blur();\n }\n };\n }\n return () => {};\n }, [inputRef]);\n\n return (\n <CardFormNative\n ref={inputRef}\n onFormComplete={onFormCompleteHandler}\n cardStyle={{\n backgroundColor: cardStyle?.backgroundColor,\n borderColor: cardStyle?.borderColor,\n borderWidth: cardStyle?.borderWidth,\n borderRadius: cardStyle?.borderRadius,\n cursorColor: cardStyle?.cursorColor,\n fontSize: cardStyle?.fontSize,\n placeholderColor: cardStyle?.placeholderColor,\n textColor: cardStyle?.textColor,\n textErrorColor: cardStyle?.textErrorColor,\n fontFamily: cardStyle?.fontFamily,\n // disabledBackgroundColor: cardStyle?.disabledBackgroundColor,\n // type: cardStyle?.type,\n }}\n // isUserInteractionEnabledValue={isUserInteractionEnabled}\n placeholders={{\n number: placeholders?.number,\n expiration: placeholders?.expiration,\n cvc: placeholders?.cvc,\n postalCode: placeholders?.postalCode,\n }}\n defaultValues={{\n ...(defaultValues ?? {}),\n }}\n onFocusChange={onFocusHandler}\n // postalCodeEnabled={postalCodeEnabled}\n {...props}\n />\n );\n }\n);\n"]}
@@ -1,2 +1,2 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.StripeProvider=StripeProvider;exports.initStripe=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _react=_interopRequireWildcard(require("react"));var _NativeStripeSdk=_interopRequireDefault(require("../NativeStripeSdk"));var _helpers=require("../helpers");var _package=_interopRequireDefault(require("../../../package.json"));function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var EXPO_PARTNER_ID='pp_partner_JBN7LkABco2yUu';var repository=_package.default.repository;var appInfo={name:(0,_helpers.shouldAttributeExpo)()?_package.default.name+"/expo":_package.default.name,url:repository.url||repository,version:_package.default.version,partnerId:(0,_helpers.shouldAttributeExpo)()?EXPO_PARTNER_ID:undefined};var initStripe=function _callee(params){var extendedParams;return _regenerator.default.async(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:extendedParams=(0,_extends2.default)({},params,{appInfo:appInfo});_NativeStripeSdk.default.initialise(extendedParams);case 2:case"end":return _context.stop();}}},null,null,null,Promise);};exports.initStripe=initStripe;function StripeProvider(_ref){var children=_ref.children,publishableKey=_ref.publishableKey,merchantIdentifier=_ref.merchantIdentifier,threeDSecureParams=_ref.threeDSecureParams,stripeAccountId=_ref.stripeAccountId,urlScheme=_ref.urlScheme,setReturnUrlSchemeOnAndroid=_ref.setReturnUrlSchemeOnAndroid;(0,_react.useEffect)(function(){if(!publishableKey){return;}if(_helpers.isAndroid){_NativeStripeSdk.default.initialise({publishableKey:publishableKey,appInfo:appInfo,stripeAccountId:stripeAccountId,threeDSecureParams:threeDSecureParams,urlScheme:urlScheme,setReturnUrlSchemeOnAndroid:setReturnUrlSchemeOnAndroid});}else{_NativeStripeSdk.default.initialise({publishableKey:publishableKey,appInfo:appInfo,stripeAccountId:stripeAccountId,threeDSecureParams:threeDSecureParams,merchantIdentifier:merchantIdentifier,urlScheme:urlScheme});}},[publishableKey,merchantIdentifier,stripeAccountId,threeDSecureParams,urlScheme,setReturnUrlSchemeOnAndroid]);return _react.default.createElement(_react.default.Fragment,null,children);}
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.StripeProvider=StripeProvider;exports.initStripe=void 0;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _react=_interopRequireWildcard(require("react"));var _NativeStripeSdk=_interopRequireDefault(require("../NativeStripeSdk"));var _helpers=require("../helpers");var _package=_interopRequireDefault(require("../../../package.json"));function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var EXPO_PARTNER_ID='pp_partner_JBN7LkABco2yUu';var repository=_package.default.repository;var appInfo={name:(0,_helpers.shouldAttributeExpo)()?_package.default.name+"/expo":_package.default.name,url:repository.url||repository,version:_package.default.version,partnerId:(0,_helpers.shouldAttributeExpo)()?EXPO_PARTNER_ID:undefined};var initStripe=function(){var _ref=(0,_asyncToGenerator2.default)(function*(params){var extendedParams=Object.assign({},params,{appInfo:appInfo});_NativeStripeSdk.default.initialise(extendedParams);});return function initStripe(_x){return _ref.apply(this,arguments);};}();exports.initStripe=initStripe;function StripeProvider(_ref2){var children=_ref2.children,publishableKey=_ref2.publishableKey,merchantIdentifier=_ref2.merchantIdentifier,threeDSecureParams=_ref2.threeDSecureParams,stripeAccountId=_ref2.stripeAccountId,urlScheme=_ref2.urlScheme,setReturnUrlSchemeOnAndroid=_ref2.setReturnUrlSchemeOnAndroid;(0,_react.useEffect)(function(){if(!publishableKey){return;}if(_helpers.isAndroid){_NativeStripeSdk.default.initialise({publishableKey:publishableKey,appInfo:appInfo,stripeAccountId:stripeAccountId,threeDSecureParams:threeDSecureParams,urlScheme:urlScheme,setReturnUrlSchemeOnAndroid:setReturnUrlSchemeOnAndroid});}else{_NativeStripeSdk.default.initialise({publishableKey:publishableKey,appInfo:appInfo,stripeAccountId:stripeAccountId,threeDSecureParams:threeDSecureParams,merchantIdentifier:merchantIdentifier,urlScheme:urlScheme});}},[publishableKey,merchantIdentifier,stripeAccountId,threeDSecureParams,urlScheme,setReturnUrlSchemeOnAndroid]);return _react.default.createElement(_react.default.Fragment,null,children);}
2
2
  //# sourceMappingURL=StripeProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["StripeProvider.tsx"],"names":["EXPO_PARTNER_ID","repository","pjson","appInfo","name","url","version","partnerId","undefined","initStripe","params","extendedParams","NativeStripeSdk","initialise","StripeProvider","children","publishableKey","merchantIdentifier","threeDSecureParams","stripeAccountId","urlScheme","setReturnUrlSchemeOnAndroid","isAndroid"],"mappings":"2WAAA,qDAEA,2EACA,mCAEA,sE,0/BAEA,GAAMA,CAAAA,eAAe,CAAG,2BAAxB,CASA,GAAMC,CAAAA,UAAe,CAAGC,iBAAMD,UAA9B,CAEA,GAAME,CAAAA,OAAgB,CAAG,CACvBC,IAAI,CAAE,mCAA2BF,iBAAME,IAAjC,SAA+CF,iBAAME,IADpC,CAKvBC,GAAG,CAAEJ,UAAU,CAACI,GAAX,EAAkBJ,UALA,CAMvBK,OAAO,CAAEJ,iBAAMI,OANQ,CAOvBC,SAAS,CAAE,mCAAwBP,eAAxB,CAA0CQ,SAP9B,CAAzB,CAUO,GAAMC,CAAAA,UAAU,CAAG,iBAAOC,MAAP,uIAClBC,cADkB,0BACsBD,MADtB,EAC8BP,OAAO,CAAPA,OAD9B,GAExBS,yBAAgBC,UAAhB,CAA2BF,cAA3B,EAFwB,qEAAnB,C,8BAyBA,QAASG,CAAAA,cAAT,MAQG,IAPRC,CAAAA,QAOQ,MAPRA,QAOQ,CANRC,cAMQ,MANRA,cAMQ,CALRC,kBAKQ,MALRA,kBAKQ,CAJRC,kBAIQ,MAJRA,kBAIQ,CAHRC,eAGQ,MAHRA,eAGQ,CAFRC,SAEQ,MAFRA,SAEQ,CADRC,2BACQ,MADRA,2BACQ,CACR,qBAAU,UAAM,CACd,GAAI,CAACL,cAAL,CAAqB,CACnB,OACD,CACD,GAAIM,kBAAJ,CAAe,CACbV,yBAAgBC,UAAhB,CAA2B,CACzBG,cAAc,CAAdA,cADyB,CAEzBb,OAAO,CAAPA,OAFyB,CAGzBgB,eAAe,CAAfA,eAHyB,CAIzBD,kBAAkB,CAAlBA,kBAJyB,CAKzBE,SAAS,CAATA,SALyB,CAMzBC,2BAA2B,CAA3BA,2BANyB,CAA3B,EAQD,CATD,IASO,CACLT,yBAAgBC,UAAhB,CAA2B,CACzBG,cAAc,CAAdA,cADyB,CAEzBb,OAAO,CAAPA,OAFyB,CAGzBgB,eAAe,CAAfA,eAHyB,CAIzBD,kBAAkB,CAAlBA,kBAJyB,CAKzBD,kBAAkB,CAAlBA,kBALyB,CAMzBG,SAAS,CAATA,SANyB,CAA3B,EAQD,CACF,CAvBD,CAuBG,CACDJ,cADC,CAEDC,kBAFC,CAGDE,eAHC,CAIDD,kBAJC,CAKDE,SALC,CAMDC,2BANC,CAvBH,EAgCA,MAAO,2DAAGN,QAAH,CAAP,CACD","sourcesContent":["import React, { useEffect } from 'react';\n\nimport NativeStripeSdk from '../NativeStripeSdk';\nimport { isAndroid, shouldAttributeExpo } from '../helpers';\nimport type { AppInfo, InitStripeParams, InitialiseParams } from '../types';\nimport pjson from '../../package.json';\n\nconst EXPO_PARTNER_ID = 'pp_partner_JBN7LkABco2yUu';\n\n/**\n * Stripe Provider Component Props\n */\nexport type Props = InitStripeParams & {\n children: React.ReactElement | React.ReactElement[];\n};\n\nconst repository: any = pjson.repository;\n\nconst appInfo: AppInfo = {\n name: shouldAttributeExpo() ? `${pjson.name}/expo` : pjson.name,\n // package.json output installed via npm is a bit different than from yarn\n // the repository field can be an object or string\n // for more context: https://github.com/stripe/stripe-react-native/issues/200\n url: repository.url || repository,\n version: pjson.version,\n partnerId: shouldAttributeExpo() ? EXPO_PARTNER_ID : undefined,\n};\n\nexport const initStripe = async (params: InitStripeParams): Promise<void> => {\n const extendedParams: InitialiseParams = { ...params, appInfo };\n NativeStripeSdk.initialise(extendedParams);\n};\n\n/**\n * StripeProvider Component\n *\n * @example\n * ```ts\n * <StripeProvider\n * publishableKey=\"_publishableKey\"\n * merchantIdentifier=\"merchant.com.stripe.react.native\"\n * threeDSecureParams={{\n * backgroundColor: \"#FFF\",\n * timeout: 5,\n * }}\n * >\n * <App />\n * </StripeProvider>\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport function StripeProvider({\n children,\n publishableKey,\n merchantIdentifier,\n threeDSecureParams,\n stripeAccountId,\n urlScheme,\n setReturnUrlSchemeOnAndroid,\n}: Props) {\n useEffect(() => {\n if (!publishableKey) {\n return;\n }\n if (isAndroid) {\n NativeStripeSdk.initialise({\n publishableKey,\n appInfo,\n stripeAccountId,\n threeDSecureParams,\n urlScheme,\n setReturnUrlSchemeOnAndroid,\n });\n } else {\n NativeStripeSdk.initialise({\n publishableKey,\n appInfo,\n stripeAccountId,\n threeDSecureParams,\n merchantIdentifier,\n urlScheme,\n });\n }\n }, [\n publishableKey,\n merchantIdentifier,\n stripeAccountId,\n threeDSecureParams,\n urlScheme,\n setReturnUrlSchemeOnAndroid,\n ]);\n\n return <>{children}</>;\n}\n"]}
1
+ {"version":3,"sources":["StripeProvider.tsx"],"names":["EXPO_PARTNER_ID","repository","pjson","appInfo","name","url","version","partnerId","undefined","initStripe","params","extendedParams","NativeStripeSdk","initialise","StripeProvider","children","publishableKey","merchantIdentifier","threeDSecureParams","stripeAccountId","urlScheme","setReturnUrlSchemeOnAndroid","isAndroid"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A,OAFyB,CAGzBgB,eAAe,CAAfA,eAHyB,CAIzBD,kBAAkB,CAAlBA,kBAJyB,CAKzBD,kBAAkB,CAAlBA,kBALyB,CAMzBG,SAAS,CAATA,SANyB,CAA3B,EAQD,CACF,CAvBD,CAuBG,CACDJ,cADC,CAEDC,kBAFC,CAGDE,eAHC,CAIDD,kBAJC,CAKDE,SALC,CAMDC,2BANC,CAvBH,EAgCA,MAAO,2DAAGN,QAAH,CAAP,CACD","sourcesContent":["import React, { useEffect } from 'react';\n\nimport NativeStripeSdk from '../NativeStripeSdk';\nimport { isAndroid, shouldAttributeExpo } from '../helpers';\nimport type { AppInfo, InitStripeParams, InitialiseParams } from '../types';\nimport pjson from '../../package.json';\n\nconst EXPO_PARTNER_ID = 'pp_partner_JBN7LkABco2yUu';\n\n/**\n * Stripe Provider Component Props\n */\nexport type Props = InitStripeParams & {\n children: React.ReactElement | React.ReactElement[];\n};\n\nconst repository: any = pjson.repository;\n\nconst appInfo: AppInfo = {\n name: shouldAttributeExpo() ? `${pjson.name}/expo` : pjson.name,\n // package.json output installed via npm is a bit different than from yarn\n // the repository field can be an object or string\n // for more context: https://github.com/stripe/stripe-react-native/issues/200\n url: repository.url || repository,\n version: pjson.version,\n partnerId: shouldAttributeExpo() ? EXPO_PARTNER_ID : undefined,\n};\n\nexport const initStripe = async (params: InitStripeParams): Promise<void> => {\n const extendedParams: InitialiseParams = { ...params, appInfo };\n NativeStripeSdk.initialise(extendedParams);\n};\n\n/**\n * StripeProvider Component\n *\n * @example\n * ```ts\n * <StripeProvider\n * publishableKey=\"_publishableKey\"\n * merchantIdentifier=\"merchant.com.stripe.react.native\"\n * threeDSecureParams={{\n * backgroundColor: \"#FFF\",\n * timeout: 5,\n * }}\n * >\n * <App />\n * </StripeProvider>\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport function StripeProvider({\n children,\n publishableKey,\n merchantIdentifier,\n threeDSecureParams,\n stripeAccountId,\n urlScheme,\n setReturnUrlSchemeOnAndroid,\n}: Props) {\n useEffect(() => {\n if (!publishableKey) {\n return;\n }\n if (isAndroid) {\n NativeStripeSdk.initialise({\n publishableKey,\n appInfo,\n stripeAccountId,\n threeDSecureParams,\n urlScheme,\n setReturnUrlSchemeOnAndroid,\n });\n } else {\n NativeStripeSdk.initialise({\n publishableKey,\n appInfo,\n stripeAccountId,\n threeDSecureParams,\n merchantIdentifier,\n urlScheme,\n });\n }\n }, [\n publishableKey,\n merchantIdentifier,\n stripeAccountId,\n threeDSecureParams,\n urlScheme,\n setReturnUrlSchemeOnAndroid,\n ]);\n\n return <>{children}</>;\n}\n"]}
@@ -1,2 +1,2 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.verifyMicrodepositsForSetup=exports.verifyMicrodepositsForPayment=exports.updateApplePaySummaryItems=exports.retrieveSetupIntent=exports.retrievePaymentIntent=exports.presentPaymentSheet=exports.presentGooglePay=exports.presentApplePay=exports.openApplePaySetup=exports.isGooglePaySupported=exports.isCardInWallet=exports.isApplePaySupported=exports.initPaymentSheet=exports.initGooglePay=exports.handleURLCallback=exports.handleNextAction=exports.createTokenForCVCUpdate=exports.createToken=exports.createPaymentMethod=exports.createGooglePayPaymentMethod=exports.confirmSetupIntent=exports.confirmPaymentSheetPayment=exports.confirmPayment=exports.confirmApplePayPayment=exports.collectBankAccountForSetup=exports.collectBankAccountForPayment=exports.canAddCardToWallet=exports.Constants=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _helpers=require("./helpers");var _Errors=require("./types/Errors");var _NativeStripeSdk=_interopRequireDefault(require("./NativeStripeSdk"));var _types=require("./types");var APPLE_PAY_NOT_SUPPORTED_MESSAGE='Apple pay is not supported on this device';var createPaymentMethod=function _callee(params){var options,_await$NativeStripeSd,paymentMethod,error,_args=arguments;return _regenerator.default.async(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:options=_args.length>1&&_args[1]!==undefined?_args[1]:{};_context.prev=1;_context.next=4;return _regenerator.default.awrap(_NativeStripeSdk.default.createPaymentMethod(params,options));case 4:_await$NativeStripeSd=_context.sent;paymentMethod=_await$NativeStripeSd.paymentMethod;error=_await$NativeStripeSd.error;if(!error){_context.next=9;break;}return _context.abrupt("return",{error:error});case 9:return _context.abrupt("return",{paymentMethod:paymentMethod});case 12:_context.prev=12;_context.t0=_context["catch"](1);return _context.abrupt("return",{error:_context.t0});case 15:case"end":return _context.stop();}}},null,null,[[1,12]],Promise);};exports.createPaymentMethod=createPaymentMethod;var createToken=function _callee2(params){var _params$country;var _await$NativeStripeSd2,token,error;return _regenerator.default.async(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:if(!(params.type==='BankAccount'&&((_params$country=params.country)==null?void 0:_params$country.toLowerCase())==='us'&&!params.routingNumber)){_context2.next=2;break;}return _context2.abrupt("return",{error:_Errors.MissingRoutingNumber});case 2:_context2.prev=2;_context2.next=5;return _regenerator.default.awrap(_NativeStripeSdk.default.createToken(params));case 5:_await$NativeStripeSd2=_context2.sent;token=_await$NativeStripeSd2.token;error=_await$NativeStripeSd2.error;if(!error){_context2.next=10;break;}return _context2.abrupt("return",{error:error});case 10:return _context2.abrupt("return",{token:token});case 13:_context2.prev=13;_context2.t0=_context2["catch"](2);return _context2.abrupt("return",{error:_context2.t0});case 16:case"end":return _context2.stop();}}},null,null,[[2,13]],Promise);};exports.createToken=createToken;var retrievePaymentIntent=function _callee3(clientSecret){var _await$NativeStripeSd3,paymentIntent,error;return _regenerator.default.async(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:_context3.prev=0;_context3.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.retrievePaymentIntent(clientSecret));case 3:_await$NativeStripeSd3=_context3.sent;paymentIntent=_await$NativeStripeSd3.paymentIntent;error=_await$NativeStripeSd3.error;if(!error){_context3.next=8;break;}return _context3.abrupt("return",{error:error});case 8:return _context3.abrupt("return",{paymentIntent:paymentIntent});case 11:_context3.prev=11;_context3.t0=_context3["catch"](0);return _context3.abrupt("return",{error:_context3.t0});case 14:case"end":return _context3.stop();}}},null,null,[[0,11]],Promise);};exports.retrievePaymentIntent=retrievePaymentIntent;var retrieveSetupIntent=function _callee4(clientSecret){var _await$NativeStripeSd4,setupIntent,error;return _regenerator.default.async(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:_context4.prev=0;_context4.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.retrieveSetupIntent(clientSecret));case 3:_await$NativeStripeSd4=_context4.sent;setupIntent=_await$NativeStripeSd4.setupIntent;error=_await$NativeStripeSd4.error;if(!error){_context4.next=8;break;}return _context4.abrupt("return",{error:error});case 8:return _context4.abrupt("return",{setupIntent:setupIntent});case 11:_context4.prev=11;_context4.t0=_context4["catch"](0);return _context4.abrupt("return",{error:_context4.t0});case 14:case"end":return _context4.stop();}}},null,null,[[0,11]],Promise);};exports.retrieveSetupIntent=retrieveSetupIntent;var confirmPayment=function _callee5(paymentIntentClientSecret,params){var options,_await$NativeStripeSd5,paymentIntent,error,_args5=arguments;return _regenerator.default.async(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:options=_args5.length>2&&_args5[2]!==undefined?_args5[2]:{};_context5.prev=1;_context5.next=4;return _regenerator.default.awrap(_NativeStripeSdk.default.confirmPayment(paymentIntentClientSecret,params,options));case 4:_await$NativeStripeSd5=_context5.sent;paymentIntent=_await$NativeStripeSd5.paymentIntent;error=_await$NativeStripeSd5.error;if(!error){_context5.next=9;break;}return _context5.abrupt("return",{error:error});case 9:return _context5.abrupt("return",{paymentIntent:paymentIntent});case 12:_context5.prev=12;_context5.t0=_context5["catch"](1);return _context5.abrupt("return",{error:_context5.t0});case 15:case"end":return _context5.stop();}}},null,null,[[1,12]],Promise);};exports.confirmPayment=confirmPayment;var isApplePaySupported=function _callee6(){return _regenerator.default.async(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:_context6.t0=_helpers.isiOS;if(!_context6.t0){_context6.next=5;break;}_context6.next=4;return _regenerator.default.awrap(_NativeStripeSdk.default.isApplePaySupported());case 4:_context6.t0=_context6.sent;case 5:return _context6.abrupt("return",_context6.t0);case 6:case"end":return _context6.stop();}}},null,null,null,Promise);};exports.isApplePaySupported=isApplePaySupported;var presentApplePay=function _callee7(params){var _await$NativeStripeSd6,paymentMethod,error;return _regenerator.default.async(function _callee7$(_context7){while(1){switch(_context7.prev=_context7.next){case 0:_context7.next=2;return _regenerator.default.awrap(_NativeStripeSdk.default.isApplePaySupported());case 2:if(_context7.sent){_context7.next=4;break;}return _context7.abrupt("return",{error:{code:_types.ApplePayError.Canceled,message:APPLE_PAY_NOT_SUPPORTED_MESSAGE}});case 4:_context7.prev=4;_context7.next=7;return _regenerator.default.awrap(_NativeStripeSdk.default.presentApplePay(params));case 7:_await$NativeStripeSd6=_context7.sent;paymentMethod=_await$NativeStripeSd6.paymentMethod;error=_await$NativeStripeSd6.error;if(!error){_context7.next=12;break;}return _context7.abrupt("return",{error:error});case 12:return _context7.abrupt("return",{paymentMethod:paymentMethod});case 15:_context7.prev=15;_context7.t0=_context7["catch"](4);return _context7.abrupt("return",{error:_context7.t0});case 18:case"end":return _context7.stop();}}},null,null,[[4,15]],Promise);};exports.presentApplePay=presentApplePay;var updateApplePaySummaryItems=function _callee8(summaryItems){var errorAddressFields,_args8=arguments;return _regenerator.default.async(function _callee8$(_context8){while(1){switch(_context8.prev=_context8.next){case 0:errorAddressFields=_args8.length>1&&_args8[1]!==undefined?_args8[1]:[];_context8.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.isApplePaySupported());case 3:if(_context8.sent){_context8.next=5;break;}return _context8.abrupt("return",{error:{code:_types.ApplePayError.Canceled,message:APPLE_PAY_NOT_SUPPORTED_MESSAGE}});case 5:_context8.prev=5;_context8.next=8;return _regenerator.default.awrap(_NativeStripeSdk.default.updateApplePaySummaryItems(summaryItems,errorAddressFields));case 8:return _context8.abrupt("return",{});case 11:_context8.prev=11;_context8.t0=_context8["catch"](5);return _context8.abrupt("return",{error:_context8.t0});case 14:case"end":return _context8.stop();}}},null,null,[[5,11]],Promise);};exports.updateApplePaySummaryItems=updateApplePaySummaryItems;var confirmApplePayPayment=function _callee9(clientSecret){return _regenerator.default.async(function _callee9$(_context9){while(1){switch(_context9.prev=_context9.next){case 0:_context9.next=2;return _regenerator.default.awrap(_NativeStripeSdk.default.isApplePaySupported());case 2:if(_context9.sent){_context9.next=4;break;}return _context9.abrupt("return",{error:{code:_types.ApplePayError.Canceled,message:APPLE_PAY_NOT_SUPPORTED_MESSAGE}});case 4:_context9.prev=4;_context9.next=7;return _regenerator.default.awrap(_NativeStripeSdk.default.confirmApplePayPayment(clientSecret));case 7:return _context9.abrupt("return",{});case 10:_context9.prev=10;_context9.t0=_context9["catch"](4);return _context9.abrupt("return",{error:_context9.t0});case 13:case"end":return _context9.stop();}}},null,null,[[4,10]],Promise);};exports.confirmApplePayPayment=confirmApplePayPayment;var handleNextAction=function _callee10(paymentIntentClientSecret){var _await$NativeStripeSd7,paymentIntent,error;return _regenerator.default.async(function _callee10$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:_context10.prev=0;_context10.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.handleNextAction(paymentIntentClientSecret));case 3:_await$NativeStripeSd7=_context10.sent;paymentIntent=_await$NativeStripeSd7.paymentIntent;error=_await$NativeStripeSd7.error;if(!error){_context10.next=8;break;}return _context10.abrupt("return",{error:error});case 8:return _context10.abrupt("return",{paymentIntent:paymentIntent});case 11:_context10.prev=11;_context10.t0=_context10["catch"](0);return _context10.abrupt("return",{error:(0,_helpers.createError)(_context10.t0)});case 14:case"end":return _context10.stop();}}},null,null,[[0,11]],Promise);};exports.handleNextAction=handleNextAction;var confirmSetupIntent=function _callee11(paymentIntentClientSecret,params){var options,_await$NativeStripeSd8,setupIntent,error,_args11=arguments;return _regenerator.default.async(function _callee11$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:options=_args11.length>2&&_args11[2]!==undefined?_args11[2]:{};_context11.prev=1;_context11.next=4;return _regenerator.default.awrap(_NativeStripeSdk.default.confirmSetupIntent(paymentIntentClientSecret,params,options));case 4:_await$NativeStripeSd8=_context11.sent;setupIntent=_await$NativeStripeSd8.setupIntent;error=_await$NativeStripeSd8.error;if(!error){_context11.next=9;break;}return _context11.abrupt("return",{error:error});case 9:return _context11.abrupt("return",{setupIntent:setupIntent});case 12:_context11.prev=12;_context11.t0=_context11["catch"](1);return _context11.abrupt("return",{error:_context11.t0});case 15:case"end":return _context11.stop();}}},null,null,[[1,12]],Promise);};exports.confirmSetupIntent=confirmSetupIntent;var createTokenForCVCUpdate=function _callee12(cvc){var _await$NativeStripeSd9,tokenId,error;return _regenerator.default.async(function _callee12$(_context12){while(1){switch(_context12.prev=_context12.next){case 0:_context12.prev=0;_context12.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.createTokenForCVCUpdate(cvc));case 3:_await$NativeStripeSd9=_context12.sent;tokenId=_await$NativeStripeSd9.tokenId;error=_await$NativeStripeSd9.error;if(!error){_context12.next=8;break;}return _context12.abrupt("return",{error:error});case 8:return _context12.abrupt("return",{tokenId:tokenId});case 11:_context12.prev=11;_context12.t0=_context12["catch"](0);return _context12.abrupt("return",{error:_context12.t0});case 14:case"end":return _context12.stop();}}},null,null,[[0,11]],Promise);};exports.createTokenForCVCUpdate=createTokenForCVCUpdate;var handleURLCallback=function _callee13(url){var stripeHandled;return _regenerator.default.async(function _callee13$(_context13){while(1){switch(_context13.prev=_context13.next){case 0:_context13.next=2;return _regenerator.default.awrap(_NativeStripeSdk.default.handleURLCallback(url));case 2:stripeHandled=_context13.sent;return _context13.abrupt("return",stripeHandled);case 4:case"end":return _context13.stop();}}},null,null,null,Promise);};exports.handleURLCallback=handleURLCallback;var verifyMicrodepositsForPayment=function _callee14(clientSecret,params){var _ref,paymentIntent,error;return _regenerator.default.async(function _callee14$(_context14){while(1){switch(_context14.prev=_context14.next){case 0:_context14.prev=0;_context14.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.verifyMicrodeposits(true,clientSecret,params));case 3:_ref=_context14.sent;paymentIntent=_ref.paymentIntent;error=_ref.error;if(!error){_context14.next=8;break;}return _context14.abrupt("return",{error:error});case 8:return _context14.abrupt("return",{paymentIntent:paymentIntent});case 11:_context14.prev=11;_context14.t0=_context14["catch"](0);return _context14.abrupt("return",{error:(0,_helpers.createError)(_context14.t0)});case 14:case"end":return _context14.stop();}}},null,null,[[0,11]],Promise);};exports.verifyMicrodepositsForPayment=verifyMicrodepositsForPayment;var verifyMicrodepositsForSetup=function _callee15(clientSecret,params){var _ref2,setupIntent,error;return _regenerator.default.async(function _callee15$(_context15){while(1){switch(_context15.prev=_context15.next){case 0:_context15.prev=0;_context15.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.verifyMicrodeposits(false,clientSecret,params));case 3:_ref2=_context15.sent;setupIntent=_ref2.setupIntent;error=_ref2.error;if(!error){_context15.next=8;break;}return _context15.abrupt("return",{error:error});case 8:return _context15.abrupt("return",{setupIntent:setupIntent});case 11:_context15.prev=11;_context15.t0=_context15["catch"](0);return _context15.abrupt("return",{error:(0,_helpers.createError)(_context15.t0)});case 14:case"end":return _context15.stop();}}},null,null,[[0,11]],Promise);};exports.verifyMicrodepositsForSetup=verifyMicrodepositsForSetup;var initPaymentSheet=function _callee16(params){var _await$NativeStripeSd10,paymentOption,error;return _regenerator.default.async(function _callee16$(_context16){while(1){switch(_context16.prev=_context16.next){case 0:_context16.prev=0;_context16.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.initPaymentSheet(params));case 3:_await$NativeStripeSd10=_context16.sent;paymentOption=_await$NativeStripeSd10.paymentOption;error=_await$NativeStripeSd10.error;if(!error){_context16.next=8;break;}return _context16.abrupt("return",{error:error});case 8:return _context16.abrupt("return",{paymentOption:paymentOption});case 11:_context16.prev=11;_context16.t0=_context16["catch"](0);return _context16.abrupt("return",{error:_context16.t0});case 14:case"end":return _context16.stop();}}},null,null,[[0,11]],Promise);};exports.initPaymentSheet=initPaymentSheet;var presentPaymentSheet=function _callee17(){var _await$NativeStripeSd11,paymentOption,error;return _regenerator.default.async(function _callee17$(_context17){while(1){switch(_context17.prev=_context17.next){case 0:_context17.prev=0;_context17.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.presentPaymentSheet());case 3:_await$NativeStripeSd11=_context17.sent;paymentOption=_await$NativeStripeSd11.paymentOption;error=_await$NativeStripeSd11.error;if(!error){_context17.next=8;break;}return _context17.abrupt("return",{error:error});case 8:return _context17.abrupt("return",{paymentOption:paymentOption});case 11:_context17.prev=11;_context17.t0=_context17["catch"](0);return _context17.abrupt("return",{error:_context17.t0});case 14:case"end":return _context17.stop();}}},null,null,[[0,11]],Promise);};exports.presentPaymentSheet=presentPaymentSheet;var confirmPaymentSheetPayment=function _callee18(){var _await$NativeStripeSd12,error;return _regenerator.default.async(function _callee18$(_context18){while(1){switch(_context18.prev=_context18.next){case 0:_context18.prev=0;_context18.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.confirmPaymentSheetPayment());case 3:_await$NativeStripeSd12=_context18.sent;error=_await$NativeStripeSd12.error;if(!error){_context18.next=7;break;}return _context18.abrupt("return",{error:error});case 7:return _context18.abrupt("return",{});case 10:_context18.prev=10;_context18.t0=_context18["catch"](0);return _context18.abrupt("return",{error:_context18.t0});case 13:case"end":return _context18.stop();}}},null,null,[[0,10]],Promise);};exports.confirmPaymentSheetPayment=confirmPaymentSheetPayment;var isGooglePaySupported=function _callee19(params){return _regenerator.default.async(function _callee19$(_context19){while(1){switch(_context19.prev=_context19.next){case 0:_context19.t0=_helpers.isAndroid;if(!_context19.t0){_context19.next=5;break;}_context19.next=4;return _regenerator.default.awrap(_NativeStripeSdk.default.isGooglePaySupported(params!=null?params:{}));case 4:_context19.t0=_context19.sent;case 5:return _context19.abrupt("return",_context19.t0);case 6:case"end":return _context19.stop();}}},null,null,null,Promise);};exports.isGooglePaySupported=isGooglePaySupported;var initGooglePay=function _callee20(params){var _await$NativeStripeSd13,error;return _regenerator.default.async(function _callee20$(_context20){while(1){switch(_context20.prev=_context20.next){case 0:_context20.prev=0;_context20.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.initGooglePay(params));case 3:_await$NativeStripeSd13=_context20.sent;error=_await$NativeStripeSd13.error;if(!error){_context20.next=7;break;}return _context20.abrupt("return",{error:error});case 7:return _context20.abrupt("return",{});case 10:_context20.prev=10;_context20.t0=_context20["catch"](0);return _context20.abrupt("return",{error:_context20.t0});case 13:case"end":return _context20.stop();}}},null,null,[[0,10]],Promise);};exports.initGooglePay=initGooglePay;var presentGooglePay=function _callee21(params){var _await$NativeStripeSd14,error;return _regenerator.default.async(function _callee21$(_context21){while(1){switch(_context21.prev=_context21.next){case 0:_context21.prev=0;_context21.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.presentGooglePay(params));case 3:_await$NativeStripeSd14=_context21.sent;error=_await$NativeStripeSd14.error;if(!error){_context21.next=7;break;}return _context21.abrupt("return",{error:error});case 7:return _context21.abrupt("return",{});case 10:_context21.prev=10;_context21.t0=_context21["catch"](0);return _context21.abrupt("return",{error:_context21.t0});case 13:case"end":return _context21.stop();}}},null,null,[[0,10]],Promise);};exports.presentGooglePay=presentGooglePay;var createGooglePayPaymentMethod=function _callee22(params){var _await$NativeStripeSd15,error,paymentMethod;return _regenerator.default.async(function _callee22$(_context22){while(1){switch(_context22.prev=_context22.next){case 0:_context22.prev=0;_context22.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.createGooglePayPaymentMethod(params));case 3:_await$NativeStripeSd15=_context22.sent;error=_await$NativeStripeSd15.error;paymentMethod=_await$NativeStripeSd15.paymentMethod;if(!error){_context22.next=8;break;}return _context22.abrupt("return",{error:error});case 8:return _context22.abrupt("return",{paymentMethod:paymentMethod});case 11:_context22.prev=11;_context22.t0=_context22["catch"](0);return _context22.abrupt("return",{error:_context22.t0});case 14:case"end":return _context22.stop();}}},null,null,[[0,11]],Promise);};exports.createGooglePayPaymentMethod=createGooglePayPaymentMethod;var openApplePaySetup=function _callee23(){var _await$NativeStripeSd16,error;return _regenerator.default.async(function _callee23$(_context23){while(1){switch(_context23.prev=_context23.next){case 0:_context23.prev=0;_context23.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.openApplePaySetup());case 3:_await$NativeStripeSd16=_context23.sent;error=_await$NativeStripeSd16.error;if(!error){_context23.next=7;break;}return _context23.abrupt("return",{error:error});case 7:return _context23.abrupt("return",{});case 10:_context23.prev=10;_context23.t0=_context23["catch"](0);return _context23.abrupt("return",{error:_context23.t0});case 13:case"end":return _context23.stop();}}},null,null,[[0,10]],Promise);};exports.openApplePaySetup=openApplePaySetup;var collectBankAccountForPayment=function _callee24(clientSecret,params){var _ref3,paymentIntent,error;return _regenerator.default.async(function _callee24$(_context24){while(1){switch(_context24.prev=_context24.next){case 0:_context24.prev=0;_context24.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.collectBankAccount(true,clientSecret,params));case 3:_ref3=_context24.sent;paymentIntent=_ref3.paymentIntent;error=_ref3.error;if(!error){_context24.next=8;break;}return _context24.abrupt("return",{error:error});case 8:return _context24.abrupt("return",{paymentIntent:paymentIntent});case 11:_context24.prev=11;_context24.t0=_context24["catch"](0);return _context24.abrupt("return",{error:(0,_helpers.createError)(_context24.t0)});case 14:case"end":return _context24.stop();}}},null,null,[[0,11]],Promise);};exports.collectBankAccountForPayment=collectBankAccountForPayment;var collectBankAccountForSetup=function _callee25(clientSecret,params){var _ref4,setupIntent,error;return _regenerator.default.async(function _callee25$(_context25){while(1){switch(_context25.prev=_context25.next){case 0:_context25.prev=0;_context25.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.collectBankAccount(false,clientSecret,params));case 3:_ref4=_context25.sent;setupIntent=_ref4.setupIntent;error=_ref4.error;if(!error){_context25.next=8;break;}return _context25.abrupt("return",{error:error});case 8:return _context25.abrupt("return",{setupIntent:setupIntent});case 11:_context25.prev=11;_context25.t0=_context25["catch"](0);return _context25.abrupt("return",{error:(0,_helpers.createError)(_context25.t0)});case 14:case"end":return _context25.stop();}}},null,null,[[0,11]],Promise);};exports.collectBankAccountForSetup=collectBankAccountForSetup;var canAddCardToWallet=function _callee26(params){var _await$NativeStripeSd17,canAddCard,details,error;return _regenerator.default.async(function _callee26$(_context26){while(1){switch(_context26.prev=_context26.next){case 0:_context26.prev=0;_context26.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.canAddCardToWallet(params));case 3:_await$NativeStripeSd17=_context26.sent;canAddCard=_await$NativeStripeSd17.canAddCard;details=_await$NativeStripeSd17.details;error=_await$NativeStripeSd17.error;if(!error){_context26.next=9;break;}return _context26.abrupt("return",{error:error});case 9:return _context26.abrupt("return",{canAddCard:canAddCard,details:details});case 12:_context26.prev=12;_context26.t0=_context26["catch"](0);return _context26.abrupt("return",{error:(0,_helpers.createError)(_context26.t0)});case 15:case"end":return _context26.stop();}}},null,null,[[0,12]],Promise);};exports.canAddCardToWallet=canAddCardToWallet;var isCardInWallet=function _callee27(params){var _await$NativeStripeSd18,isInWallet,token,error;return _regenerator.default.async(function _callee27$(_context27){while(1){switch(_context27.prev=_context27.next){case 0:_context27.prev=0;_context27.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.isCardInWallet(params));case 3:_await$NativeStripeSd18=_context27.sent;isInWallet=_await$NativeStripeSd18.isInWallet;token=_await$NativeStripeSd18.token;error=_await$NativeStripeSd18.error;if(!error){_context27.next=9;break;}return _context27.abrupt("return",{error:error});case 9:return _context27.abrupt("return",{isInWallet:isInWallet,token:token});case 12:_context27.prev=12;_context27.t0=_context27["catch"](0);return _context27.abrupt("return",{error:(0,_helpers.createError)(_context27.t0)});case 15:case"end":return _context27.stop();}}},null,null,[[0,12]],Promise);};exports.isCardInWallet=isCardInWallet;var Constants=_NativeStripeSdk.default.getConstants();exports.Constants=Constants;
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.verifyMicrodepositsForSetup=exports.verifyMicrodepositsForPayment=exports.updateApplePaySummaryItems=exports.retrieveSetupIntent=exports.retrievePaymentIntent=exports.presentPaymentSheet=exports.presentGooglePay=exports.presentApplePay=exports.openApplePaySetup=exports.isGooglePaySupported=exports.isCardInWallet=exports.isApplePaySupported=exports.initPaymentSheet=exports.initGooglePay=exports.handleURLCallback=exports.handleNextAction=exports.createTokenForCVCUpdate=exports.createToken=exports.createPaymentMethod=exports.createGooglePayPaymentMethod=exports.confirmSetupIntent=exports.confirmPaymentSheetPayment=exports.confirmPayment=exports.confirmApplePayPayment=exports.collectFinancialConnectionsAccounts=exports.collectBankAccountToken=exports.collectBankAccountForSetup=exports.collectBankAccountForPayment=exports.canAddCardToWallet=exports.Constants=void 0;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _helpers=require("./helpers");var _Errors=require("./types/Errors");var _NativeStripeSdk=_interopRequireDefault(require("./NativeStripeSdk"));var _types=require("./types");var APPLE_PAY_NOT_SUPPORTED_MESSAGE='Apple pay is not supported on this device';var createPaymentMethod=function(){var _ref=(0,_asyncToGenerator2.default)(function*(params){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};try{var _yield$NativeStripeSd=yield _NativeStripeSdk.default.createPaymentMethod(params,options),paymentMethod=_yield$NativeStripeSd.paymentMethod,error=_yield$NativeStripeSd.error;if(error){return{error:error};}return{paymentMethod:paymentMethod};}catch(error){return{error:error};}});return function createPaymentMethod(_x){return _ref.apply(this,arguments);};}();exports.createPaymentMethod=createPaymentMethod;var createToken=function(){var _ref2=(0,_asyncToGenerator2.default)(function*(params){var _params$country;if(params.type==='BankAccount'&&((_params$country=params.country)==null?void 0:_params$country.toLowerCase())==='us'&&!params.routingNumber){return{error:_Errors.MissingRoutingNumber};}try{var _yield$NativeStripeSd2=yield _NativeStripeSdk.default.createToken(params),token=_yield$NativeStripeSd2.token,error=_yield$NativeStripeSd2.error;if(error){return{error:error};}return{token:token};}catch(error){return{error:error};}});return function createToken(_x2){return _ref2.apply(this,arguments);};}();exports.createToken=createToken;var retrievePaymentIntent=function(){var _ref3=(0,_asyncToGenerator2.default)(function*(clientSecret){try{var _yield$NativeStripeSd3=yield _NativeStripeSdk.default.retrievePaymentIntent(clientSecret),paymentIntent=_yield$NativeStripeSd3.paymentIntent,error=_yield$NativeStripeSd3.error;if(error){return{error:error};}return{paymentIntent:paymentIntent};}catch(error){return{error:error};}});return function retrievePaymentIntent(_x3){return _ref3.apply(this,arguments);};}();exports.retrievePaymentIntent=retrievePaymentIntent;var retrieveSetupIntent=function(){var _ref4=(0,_asyncToGenerator2.default)(function*(clientSecret){try{var _yield$NativeStripeSd4=yield _NativeStripeSdk.default.retrieveSetupIntent(clientSecret),setupIntent=_yield$NativeStripeSd4.setupIntent,error=_yield$NativeStripeSd4.error;if(error){return{error:error};}return{setupIntent:setupIntent};}catch(error){return{error:error};}});return function retrieveSetupIntent(_x4){return _ref4.apply(this,arguments);};}();exports.retrieveSetupIntent=retrieveSetupIntent;var confirmPayment=function(){var _ref5=(0,_asyncToGenerator2.default)(function*(paymentIntentClientSecret,params){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};try{var _yield$NativeStripeSd5=yield _NativeStripeSdk.default.confirmPayment(paymentIntentClientSecret,params,options),paymentIntent=_yield$NativeStripeSd5.paymentIntent,error=_yield$NativeStripeSd5.error;if(error){return{error:error};}return{paymentIntent:paymentIntent};}catch(error){return{error:error};}});return function confirmPayment(_x5,_x6){return _ref5.apply(this,arguments);};}();exports.confirmPayment=confirmPayment;var isApplePaySupported=function(){var _ref6=(0,_asyncToGenerator2.default)(function*(){return _helpers.isiOS&&(yield _NativeStripeSdk.default.isApplePaySupported());});return function isApplePaySupported(){return _ref6.apply(this,arguments);};}();exports.isApplePaySupported=isApplePaySupported;var presentApplePay=function(){var _ref7=(0,_asyncToGenerator2.default)(function*(params){if(!(yield _NativeStripeSdk.default.isApplePaySupported())){return{error:{code:_types.ApplePayError.Canceled,message:APPLE_PAY_NOT_SUPPORTED_MESSAGE}};}try{var _yield$NativeStripeSd6=yield _NativeStripeSdk.default.presentApplePay(params),paymentMethod=_yield$NativeStripeSd6.paymentMethod,error=_yield$NativeStripeSd6.error;if(error){return{error:error};}return{paymentMethod:paymentMethod};}catch(error){return{error:error};}});return function presentApplePay(_x7){return _ref7.apply(this,arguments);};}();exports.presentApplePay=presentApplePay;var updateApplePaySummaryItems=function(){var _ref8=(0,_asyncToGenerator2.default)(function*(summaryItems){var errorAddressFields=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];if(!(yield _NativeStripeSdk.default.isApplePaySupported())){return{error:{code:_types.ApplePayError.Canceled,message:APPLE_PAY_NOT_SUPPORTED_MESSAGE}};}try{yield _NativeStripeSdk.default.updateApplePaySummaryItems(summaryItems,errorAddressFields);return{};}catch(error){return{error:error};}});return function updateApplePaySummaryItems(_x8){return _ref8.apply(this,arguments);};}();exports.updateApplePaySummaryItems=updateApplePaySummaryItems;var confirmApplePayPayment=function(){var _ref9=(0,_asyncToGenerator2.default)(function*(clientSecret){if(!(yield _NativeStripeSdk.default.isApplePaySupported())){return{error:{code:_types.ApplePayError.Canceled,message:APPLE_PAY_NOT_SUPPORTED_MESSAGE}};}try{yield _NativeStripeSdk.default.confirmApplePayPayment(clientSecret);return{};}catch(error){return{error:error};}});return function confirmApplePayPayment(_x9){return _ref9.apply(this,arguments);};}();exports.confirmApplePayPayment=confirmApplePayPayment;var handleNextAction=function(){var _ref10=(0,_asyncToGenerator2.default)(function*(paymentIntentClientSecret){try{var _yield$NativeStripeSd7=yield _NativeStripeSdk.default.handleNextAction(paymentIntentClientSecret),paymentIntent=_yield$NativeStripeSd7.paymentIntent,error=_yield$NativeStripeSd7.error;if(error){return{error:error};}return{paymentIntent:paymentIntent};}catch(error){return{error:(0,_helpers.createError)(error)};}});return function handleNextAction(_x10){return _ref10.apply(this,arguments);};}();exports.handleNextAction=handleNextAction;var confirmSetupIntent=function(){var _ref11=(0,_asyncToGenerator2.default)(function*(paymentIntentClientSecret,params){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};try{var _yield$NativeStripeSd8=yield _NativeStripeSdk.default.confirmSetupIntent(paymentIntentClientSecret,params,options),setupIntent=_yield$NativeStripeSd8.setupIntent,error=_yield$NativeStripeSd8.error;if(error){return{error:error};}return{setupIntent:setupIntent};}catch(error){return{error:error};}});return function confirmSetupIntent(_x11,_x12){return _ref11.apply(this,arguments);};}();exports.confirmSetupIntent=confirmSetupIntent;var createTokenForCVCUpdate=function(){var _ref12=(0,_asyncToGenerator2.default)(function*(cvc){try{var _yield$NativeStripeSd9=yield _NativeStripeSdk.default.createTokenForCVCUpdate(cvc),tokenId=_yield$NativeStripeSd9.tokenId,error=_yield$NativeStripeSd9.error;if(error){return{error:error};}return{tokenId:tokenId};}catch(error){return{error:error};}});return function createTokenForCVCUpdate(_x13){return _ref12.apply(this,arguments);};}();exports.createTokenForCVCUpdate=createTokenForCVCUpdate;var handleURLCallback=function(){var _ref13=(0,_asyncToGenerator2.default)(function*(url){var stripeHandled=yield _NativeStripeSdk.default.handleURLCallback(url);return stripeHandled;});return function handleURLCallback(_x14){return _ref13.apply(this,arguments);};}();exports.handleURLCallback=handleURLCallback;var verifyMicrodepositsForPayment=function(){var _ref14=(0,_asyncToGenerator2.default)(function*(clientSecret,params){try{var _ref15=yield _NativeStripeSdk.default.verifyMicrodeposits(true,clientSecret,params),paymentIntent=_ref15.paymentIntent,error=_ref15.error;if(error){return{error:error};}return{paymentIntent:paymentIntent};}catch(error){return{error:(0,_helpers.createError)(error)};}});return function verifyMicrodepositsForPayment(_x15,_x16){return _ref14.apply(this,arguments);};}();exports.verifyMicrodepositsForPayment=verifyMicrodepositsForPayment;var verifyMicrodepositsForSetup=function(){var _ref16=(0,_asyncToGenerator2.default)(function*(clientSecret,params){try{var _ref17=yield _NativeStripeSdk.default.verifyMicrodeposits(false,clientSecret,params),setupIntent=_ref17.setupIntent,error=_ref17.error;if(error){return{error:error};}return{setupIntent:setupIntent};}catch(error){return{error:(0,_helpers.createError)(error)};}});return function verifyMicrodepositsForSetup(_x17,_x18){return _ref16.apply(this,arguments);};}();exports.verifyMicrodepositsForSetup=verifyMicrodepositsForSetup;var initPaymentSheet=function(){var _ref18=(0,_asyncToGenerator2.default)(function*(params){try{var _yield$NativeStripeSd10=yield _NativeStripeSdk.default.initPaymentSheet(params),paymentOption=_yield$NativeStripeSd10.paymentOption,error=_yield$NativeStripeSd10.error;if(error){return{error:error};}return{paymentOption:paymentOption};}catch(error){return{error:error};}});return function initPaymentSheet(_x19){return _ref18.apply(this,arguments);};}();exports.initPaymentSheet=initPaymentSheet;var presentPaymentSheet=function(){var _ref19=(0,_asyncToGenerator2.default)(function*(){try{var _yield$NativeStripeSd11=yield _NativeStripeSdk.default.presentPaymentSheet(),paymentOption=_yield$NativeStripeSd11.paymentOption,error=_yield$NativeStripeSd11.error;if(error){return{error:error};}return{paymentOption:paymentOption};}catch(error){return{error:error};}});return function presentPaymentSheet(){return _ref19.apply(this,arguments);};}();exports.presentPaymentSheet=presentPaymentSheet;var confirmPaymentSheetPayment=function(){var _ref20=(0,_asyncToGenerator2.default)(function*(){try{var _yield$NativeStripeSd12=yield _NativeStripeSdk.default.confirmPaymentSheetPayment(),error=_yield$NativeStripeSd12.error;if(error){return{error:error};}return{};}catch(error){return{error:error};}});return function confirmPaymentSheetPayment(){return _ref20.apply(this,arguments);};}();exports.confirmPaymentSheetPayment=confirmPaymentSheetPayment;var isGooglePaySupported=function(){var _ref21=(0,_asyncToGenerator2.default)(function*(params){return _helpers.isAndroid&&(yield _NativeStripeSdk.default.isGooglePaySupported(params!=null?params:{}));});return function isGooglePaySupported(_x20){return _ref21.apply(this,arguments);};}();exports.isGooglePaySupported=isGooglePaySupported;var initGooglePay=function(){var _ref22=(0,_asyncToGenerator2.default)(function*(params){try{var _yield$NativeStripeSd13=yield _NativeStripeSdk.default.initGooglePay(params),error=_yield$NativeStripeSd13.error;if(error){return{error:error};}return{};}catch(error){return{error:error};}});return function initGooglePay(_x21){return _ref22.apply(this,arguments);};}();exports.initGooglePay=initGooglePay;var presentGooglePay=function(){var _ref23=(0,_asyncToGenerator2.default)(function*(params){try{var _yield$NativeStripeSd14=yield _NativeStripeSdk.default.presentGooglePay(params),error=_yield$NativeStripeSd14.error;if(error){return{error:error};}return{};}catch(error){return{error:error};}});return function presentGooglePay(_x22){return _ref23.apply(this,arguments);};}();exports.presentGooglePay=presentGooglePay;var createGooglePayPaymentMethod=function(){var _ref24=(0,_asyncToGenerator2.default)(function*(params){try{var _yield$NativeStripeSd15=yield _NativeStripeSdk.default.createGooglePayPaymentMethod(params),error=_yield$NativeStripeSd15.error,paymentMethod=_yield$NativeStripeSd15.paymentMethod;if(error){return{error:error};}return{paymentMethod:paymentMethod};}catch(error){return{error:error};}});return function createGooglePayPaymentMethod(_x23){return _ref24.apply(this,arguments);};}();exports.createGooglePayPaymentMethod=createGooglePayPaymentMethod;var openApplePaySetup=function(){var _ref25=(0,_asyncToGenerator2.default)(function*(){try{var _yield$NativeStripeSd16=yield _NativeStripeSdk.default.openApplePaySetup(),error=_yield$NativeStripeSd16.error;if(error){return{error:error};}return{};}catch(error){return{error:error};}});return function openApplePaySetup(){return _ref25.apply(this,arguments);};}();exports.openApplePaySetup=openApplePaySetup;var collectBankAccountForPayment=function(){var _ref26=(0,_asyncToGenerator2.default)(function*(clientSecret,params){try{var _ref27=yield _NativeStripeSdk.default.collectBankAccount(true,clientSecret,params),paymentIntent=_ref27.paymentIntent,error=_ref27.error;if(error){return{error:error};}return{paymentIntent:paymentIntent};}catch(error){return{error:(0,_helpers.createError)(error)};}});return function collectBankAccountForPayment(_x24,_x25){return _ref26.apply(this,arguments);};}();exports.collectBankAccountForPayment=collectBankAccountForPayment;var collectBankAccountForSetup=function(){var _ref28=(0,_asyncToGenerator2.default)(function*(clientSecret,params){try{var _ref29=yield _NativeStripeSdk.default.collectBankAccount(false,clientSecret,params),setupIntent=_ref29.setupIntent,error=_ref29.error;if(error){return{error:error};}return{setupIntent:setupIntent};}catch(error){return{error:(0,_helpers.createError)(error)};}});return function collectBankAccountForSetup(_x26,_x27){return _ref28.apply(this,arguments);};}();exports.collectBankAccountForSetup=collectBankAccountForSetup;var collectBankAccountToken=function(){var _ref30=(0,_asyncToGenerator2.default)(function*(clientSecret){try{var _yield$NativeStripeSd17=yield _NativeStripeSdk.default.collectBankAccountToken(clientSecret),session=_yield$NativeStripeSd17.session,token=_yield$NativeStripeSd17.token,error=_yield$NativeStripeSd17.error;if(error){return{error:error};}return{session:session,token:token};}catch(error){return{error:(0,_helpers.createError)(error)};}});return function collectBankAccountToken(_x28){return _ref30.apply(this,arguments);};}();exports.collectBankAccountToken=collectBankAccountToken;var collectFinancialConnectionsAccounts=function(){var _ref31=(0,_asyncToGenerator2.default)(function*(clientSecret){try{var _yield$NativeStripeSd18=yield _NativeStripeSdk.default.collectFinancialConnectionsAccounts(clientSecret),session=_yield$NativeStripeSd18.session,error=_yield$NativeStripeSd18.error;if(error){return{error:error};}return{session:session};}catch(error){return{error:(0,_helpers.createError)(error)};}});return function collectFinancialConnectionsAccounts(_x29){return _ref31.apply(this,arguments);};}();exports.collectFinancialConnectionsAccounts=collectFinancialConnectionsAccounts;var canAddCardToWallet=function(){var _ref32=(0,_asyncToGenerator2.default)(function*(params){try{var _yield$NativeStripeSd19=yield _NativeStripeSdk.default.canAddCardToWallet(params),canAddCard=_yield$NativeStripeSd19.canAddCard,details=_yield$NativeStripeSd19.details,error=_yield$NativeStripeSd19.error;if(error){return{error:error};}return{canAddCard:canAddCard,details:details};}catch(error){return{error:(0,_helpers.createError)(error)};}});return function canAddCardToWallet(_x30){return _ref32.apply(this,arguments);};}();exports.canAddCardToWallet=canAddCardToWallet;var isCardInWallet=function(){var _ref33=(0,_asyncToGenerator2.default)(function*(params){try{var _yield$NativeStripeSd20=yield _NativeStripeSdk.default.isCardInWallet(params),isInWallet=_yield$NativeStripeSd20.isInWallet,token=_yield$NativeStripeSd20.token,error=_yield$NativeStripeSd20.error;if(error){return{error:error};}return{isInWallet:isInWallet,token:token};}catch(error){return{error:(0,_helpers.createError)(error)};}});return function isCardInWallet(_x31){return _ref33.apply(this,arguments);};}();exports.isCardInWallet=isCardInWallet;var Constants=_NativeStripeSdk.default.getConstants();exports.Constants=Constants;
2
2
  //# sourceMappingURL=functions.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["functions.ts"],"names":["APPLE_PAY_NOT_SUPPORTED_MESSAGE","createPaymentMethod","params","options","NativeStripeSdk","paymentMethod","error","createToken","type","country","toLowerCase","routingNumber","MissingRoutingNumber","token","retrievePaymentIntent","clientSecret","paymentIntent","retrieveSetupIntent","setupIntent","confirmPayment","paymentIntentClientSecret","isApplePaySupported","isiOS","presentApplePay","code","ApplePayError","Canceled","message","updateApplePaySummaryItems","summaryItems","errorAddressFields","confirmApplePayPayment","handleNextAction","confirmSetupIntent","createTokenForCVCUpdate","cvc","tokenId","handleURLCallback","url","stripeHandled","verifyMicrodepositsForPayment","verifyMicrodeposits","verifyMicrodepositsForSetup","initPaymentSheet","paymentOption","presentPaymentSheet","confirmPaymentSheetPayment","isGooglePaySupported","isAndroid","initGooglePay","presentGooglePay","createGooglePayPaymentMethod","openApplePaySetup","collectBankAccountForPayment","collectBankAccount","collectBankAccountForSetup","canAddCardToWallet","canAddCard","details","isCardInWallet","isInWallet","Constants","getConstants"],"mappings":"ggCAAA,kCACA,sCACA,0EACA,8BAoCA,GAAMA,CAAAA,+BAA+B,CACnC,2CADF,CAGO,GAAMC,CAAAA,mBAAmB,CAAG,iBACjCC,MADiC,0LAEjCC,OAFiC,+CAEM,EAFN,mEAKQC,yBAAgBH,mBAAhB,CACrCC,MADqC,CAErCC,OAFqC,CALR,6CAKvBE,aALuB,uBAKvBA,aALuB,CAKRC,KALQ,uBAKRA,KALQ,KAS3BA,KAT2B,yDAUtB,CACLA,KAAK,CAALA,KADK,CAVsB,yCAcxB,CACLD,aAAa,CAAEA,aADV,CAdwB,4F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,CAIDpD,KAJC,yBAIDA,KAJC,KAO1BA,KAP0B,6DAQrB,CACLA,KAAK,CAALA,KADK,CARqB,2CAYvB,CACLmD,UAAU,CAAEA,UADP,CAELC,OAAO,CAAEA,OAFJ,CAZuB,oGAiBvB,CACLpD,KAAK,CAAE,uCADF,CAjBuB,8EAA3B,C,8CAuBA,GAAMqD,CAAAA,cAAc,CAAG,mBAAOzD,MAAP,qPAIiBE,yBAAgBuD,cAAhB,CACzCzD,MADyC,CAJjB,iDAIlB0D,UAJkB,yBAIlBA,UAJkB,CAIN/C,KAJM,yBAINA,KAJM,CAICP,KAJD,yBAICA,KAJD,KAQtBA,KARsB,6DASjB,CACLA,KAAK,CAALA,KADK,CATiB,2CAanB,CACLsD,UAAU,CAAEA,UADP,CAEL/C,KAAK,CAAEA,KAFF,CAbmB,oGAkBnB,CACLP,KAAK,CAAE,uCADF,CAlBmB,8EAAvB,C,sCAwBA,GAAMuD,CAAAA,SAAS,CAAGzD,yBAAgB0D,YAAhB,EAAlB,C","sourcesContent":["import { isAndroid, isiOS, createError } from './helpers';\nimport { MissingRoutingNumber } from './types/Errors';\nimport NativeStripeSdk from './NativeStripeSdk';\nimport {\n ApplePay,\n ApplePayError,\n ApplePayResult,\n ConfirmPaymentResult,\n ConfirmPaymentSheetPaymentResult,\n SetupIntent,\n PaymentIntent,\n ConfirmSetupIntentResult,\n CreatePaymentMethodResult,\n CreateTokenForCVCUpdateResult,\n CreateTokenResult,\n GooglePayInitResult,\n HandleNextActionResult,\n InitPaymentSheetResult,\n PaymentMethod,\n PaymentSheet,\n PayWithGooglePayResult,\n PresentPaymentSheetResult,\n RetrievePaymentIntentResult,\n RetrieveSetupIntentResult,\n StripeError,\n GooglePay,\n CreateGooglePayPaymentMethodResult,\n OpenApplePaySetupResult,\n Token,\n VerifyMicrodepositsParams,\n VerifyMicrodepositsForPaymentResult,\n VerifyMicrodepositsForSetupResult,\n CollectBankAccountForPaymentResult,\n CollectBankAccountForSetupResult,\n IsCardInWalletResult,\n CanAddCardToWalletParams,\n CanAddCardToWalletResult,\n} from './types';\n\nconst APPLE_PAY_NOT_SUPPORTED_MESSAGE =\n 'Apple pay is not supported on this device';\n\nexport const createPaymentMethod = async (\n params: PaymentMethod.CreateParams,\n options: PaymentMethod.CreateOptions = {}\n): Promise<CreatePaymentMethodResult> => {\n try {\n const { paymentMethod, error } = await NativeStripeSdk.createPaymentMethod(\n params,\n options\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentMethod: paymentMethod!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const createToken = async (\n params: Token.CreateParams\n): Promise<CreateTokenResult> => {\n if (\n params.type === 'BankAccount' &&\n params.country?.toLowerCase() === 'us' &&\n !params.routingNumber\n ) {\n return {\n error: MissingRoutingNumber,\n };\n }\n\n try {\n const { token, error } = await NativeStripeSdk.createToken(params);\n\n if (error) {\n return {\n error,\n };\n }\n return {\n token: token!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const retrievePaymentIntent = async (\n clientSecret: string\n): Promise<RetrievePaymentIntentResult> => {\n try {\n const { paymentIntent, error } =\n await NativeStripeSdk.retrievePaymentIntent(clientSecret);\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const retrieveSetupIntent = async (\n clientSecret: string\n): Promise<RetrieveSetupIntentResult> => {\n try {\n const { setupIntent, error } = await NativeStripeSdk.retrieveSetupIntent(\n clientSecret\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n setupIntent: setupIntent!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const confirmPayment = async (\n paymentIntentClientSecret: string,\n params: PaymentIntent.ConfirmParams,\n options: PaymentIntent.ConfirmOptions = {}\n): Promise<ConfirmPaymentResult> => {\n try {\n const { paymentIntent, error } = await NativeStripeSdk.confirmPayment(\n paymentIntentClientSecret,\n params,\n options\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const isApplePaySupported = async (): Promise<boolean> => {\n return isiOS && (await NativeStripeSdk.isApplePaySupported());\n};\n\nexport const presentApplePay = async (\n params: ApplePay.PresentParams\n): Promise<ApplePayResult> => {\n if (!(await NativeStripeSdk.isApplePaySupported())) {\n return {\n error: {\n code: ApplePayError.Canceled,\n message: APPLE_PAY_NOT_SUPPORTED_MESSAGE,\n },\n };\n }\n\n try {\n const { paymentMethod, error } = await NativeStripeSdk.presentApplePay(\n params\n );\n if (error) {\n return {\n error,\n };\n }\n return { paymentMethod: paymentMethod! };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const updateApplePaySummaryItems = async (\n summaryItems: ApplePay.CartSummaryItem[],\n errorAddressFields: Array<{\n field: ApplePay.AddressFields;\n message?: string;\n }> = []\n): Promise<{ error?: StripeError<ApplePayError> }> => {\n if (!(await NativeStripeSdk.isApplePaySupported())) {\n return {\n error: {\n code: ApplePayError.Canceled,\n message: APPLE_PAY_NOT_SUPPORTED_MESSAGE,\n },\n };\n }\n\n try {\n await NativeStripeSdk.updateApplePaySummaryItems(\n summaryItems,\n errorAddressFields\n );\n\n return {};\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const confirmApplePayPayment = async (\n clientSecret: string\n): Promise<{ error?: StripeError<ApplePayError> }> => {\n if (!(await NativeStripeSdk.isApplePaySupported())) {\n return {\n error: {\n code: ApplePayError.Canceled,\n message: APPLE_PAY_NOT_SUPPORTED_MESSAGE,\n },\n };\n }\n try {\n await NativeStripeSdk.confirmApplePayPayment(clientSecret);\n return {};\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const handleNextAction = async (\n paymentIntentClientSecret: string\n): Promise<HandleNextActionResult> => {\n try {\n const { paymentIntent, error } = await NativeStripeSdk.handleNextAction(\n paymentIntentClientSecret\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const confirmSetupIntent = async (\n paymentIntentClientSecret: string,\n params: SetupIntent.ConfirmParams,\n options: SetupIntent.ConfirmOptions = {}\n): Promise<ConfirmSetupIntentResult> => {\n try {\n const { setupIntent, error } = await NativeStripeSdk.confirmSetupIntent(\n paymentIntentClientSecret,\n params,\n options\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n setupIntent: setupIntent!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const createTokenForCVCUpdate = async (\n cvc: string\n): Promise<CreateTokenForCVCUpdateResult> => {\n try {\n const { tokenId, error } = await NativeStripeSdk.createTokenForCVCUpdate(\n cvc\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n tokenId: tokenId!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const handleURLCallback = async (url: string): Promise<boolean> => {\n const stripeHandled = await NativeStripeSdk.handleURLCallback(url);\n return stripeHandled;\n};\n\nexport const verifyMicrodepositsForPayment = async (\n clientSecret: string,\n params: VerifyMicrodepositsParams\n): Promise<VerifyMicrodepositsForPaymentResult> => {\n try {\n const { paymentIntent, error } = (await NativeStripeSdk.verifyMicrodeposits(\n true,\n clientSecret,\n params\n )) as VerifyMicrodepositsForPaymentResult;\n\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const verifyMicrodepositsForSetup = async (\n clientSecret: string,\n params: VerifyMicrodepositsParams\n): Promise<VerifyMicrodepositsForSetupResult> => {\n try {\n const { setupIntent, error } = (await NativeStripeSdk.verifyMicrodeposits(\n false,\n clientSecret,\n params\n )) as VerifyMicrodepositsForSetupResult;\n\n if (error) {\n return {\n error,\n };\n }\n return {\n setupIntent: setupIntent!,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const initPaymentSheet = async (\n params: PaymentSheet.SetupParams\n): Promise<InitPaymentSheetResult> => {\n try {\n const { paymentOption, error } = await NativeStripeSdk.initPaymentSheet(\n params\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentOption,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const presentPaymentSheet =\n async (): Promise<PresentPaymentSheetResult> => {\n try {\n const { paymentOption, error } =\n await NativeStripeSdk.presentPaymentSheet();\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentOption: paymentOption!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n };\n\nexport const confirmPaymentSheetPayment =\n async (): Promise<ConfirmPaymentSheetPaymentResult> => {\n try {\n const { error } = await NativeStripeSdk.confirmPaymentSheetPayment();\n if (error) {\n return {\n error,\n };\n }\n return {};\n } catch (error: any) {\n return {\n error,\n };\n }\n };\n\nexport const isGooglePaySupported = async (\n params?: GooglePay.IsSupportedParams\n): Promise<boolean> => {\n return (\n isAndroid && (await NativeStripeSdk.isGooglePaySupported(params ?? {}))\n );\n};\n\nexport const initGooglePay = async (\n params: GooglePay.InitParams\n): Promise<GooglePayInitResult> => {\n try {\n const { error } = await NativeStripeSdk.initGooglePay(params);\n if (error) {\n return {\n error,\n };\n }\n return {};\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const presentGooglePay = async (\n params: GooglePay.PresentParams\n): Promise<PayWithGooglePayResult> => {\n try {\n const { error } = await NativeStripeSdk.presentGooglePay(params);\n if (error) {\n return {\n error,\n };\n }\n return {};\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const createGooglePayPaymentMethod = async (\n params: GooglePay.CreatePaymentMethodParams\n): Promise<CreateGooglePayPaymentMethodResult> => {\n try {\n const { error, paymentMethod } =\n await NativeStripeSdk.createGooglePayPaymentMethod(params);\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentMethod: paymentMethod!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const openApplePaySetup = async (): Promise<OpenApplePaySetupResult> => {\n try {\n const { error } = await NativeStripeSdk.openApplePaySetup();\n if (error) {\n return {\n error,\n };\n }\n return {};\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const collectBankAccountForPayment = async (\n clientSecret: string,\n params: PaymentMethod.CollectBankAccountParams\n): Promise<CollectBankAccountForPaymentResult> => {\n try {\n const { paymentIntent, error } = (await NativeStripeSdk.collectBankAccount(\n true,\n clientSecret,\n params\n )) as CollectBankAccountForPaymentResult;\n\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const collectBankAccountForSetup = async (\n clientSecret: string,\n params: PaymentMethod.CollectBankAccountParams\n): Promise<CollectBankAccountForSetupResult> => {\n try {\n const { setupIntent, error } = (await NativeStripeSdk.collectBankAccount(\n false,\n clientSecret,\n params\n )) as CollectBankAccountForSetupResult;\n\n if (error) {\n return {\n error,\n };\n }\n return {\n setupIntent: setupIntent!,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const canAddCardToWallet = async (\n params: CanAddCardToWalletParams\n): Promise<CanAddCardToWalletResult> => {\n try {\n const { canAddCard, details, error } =\n await NativeStripeSdk.canAddCardToWallet(params);\n\n if (error) {\n return {\n error,\n };\n }\n return {\n canAddCard: canAddCard as boolean,\n details: details,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const isCardInWallet = async (params: {\n cardLastFour: string;\n}): Promise<IsCardInWalletResult> => {\n try {\n const { isInWallet, token, error } = await NativeStripeSdk.isCardInWallet(\n params\n );\n\n if (error) {\n return {\n error,\n };\n }\n return {\n isInWallet: isInWallet as boolean,\n token: token,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const Constants = NativeStripeSdk.getConstants();\n"]}
1
+ {"version":3,"sources":["functions.ts"],"names":["APPLE_PAY_NOT_SUPPORTED_MESSAGE","createPaymentMethod","params","options","NativeStripeSdk","paymentMethod","error","createToken","type","country","toLowerCase","routingNumber","MissingRoutingNumber","token","retrievePaymentIntent","clientSecret","paymentIntent","retrieveSetupIntent","setupIntent","confirmPayment","paymentIntentClientSecret","isApplePaySupported","isiOS","presentApplePay","code","ApplePayError","Canceled","message","updateApplePaySummaryItems","summaryItems","errorAddressFields","confirmApplePayPayment","handleNextAction","confirmSetupIntent","createTokenForCVCUpdate","cvc","tokenId","handleURLCallback","url","stripeHandled","verifyMicrodepositsForPayment","verifyMicrodeposits","verifyMicrodepositsForSetup","initPaymentSheet","paymentOption","presentPaymentSheet","confirmPaymentSheetPayment","isGooglePaySupported","isAndroid","initGooglePay","presentGooglePay","createGooglePayPaymentMethod","openApplePaySetup","collectBankAccountForPayment","collectBankAccount","collectBankAccountForSetup","collectBankAccountToken","session","collectFinancialConnectionsAccounts","canAddCardToWallet","canAddCard","details","isCardInWallet","isInWallet","Constants","getConstants"],"mappings":"+lCAAA,kCACA,sCACA,0EACA,8BAqCA,GAAMA,CAAAA,+BAA+B,CACnC,2CADF,CAGO,GAAMC,CAAAA,mBAAmB,oDAAG,UACjCC,MADiC,CAGM,IADvCC,CAAAA,OACuC,2DADA,EACA,CACvC,GAAI,CACF,+BAAuCC,0BAAgBH,mBAAhB,CACrCC,MADqC,CAErCC,OAFqC,CAAvC,CAAQE,aAAR,uBAAQA,aAAR,CAAuBC,KAAvB,uBAAuBA,KAAvB,CAIA,GAAIA,KAAJ,CAAW,CACT,MAAO,CACLA,KAAK,CAALA,KADK,CAAP,CAGD,CACD,MAAO,CACLD,aAAa,CAAEA,aADV,CAAP,CAGD,CAAC,MAAOC,KAAP,CAAmB,CACnB,MAAO,CACLA,KAAK,CAALA,KADK,CAAP,CAGD,CACF,CAtB+B,iBAAnBL,CAAAA,mBAAmB,4CAAzB,C,gDAwBA,GAAMM,CAAAA,WAAW,qDAAG,UACzBL,MADyB,CAEM,qBAC/B,GACEA,MAAM,CAACM,IAAP,GAAgB,aAAhB,EACA,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AoBA,OAApB,CAA6BvD,KAA7B,yBAA6BA,KAA7B,CAGA,GAAIA,KAAJ,CAAW,CACT,MAAO,CACLA,KAAK,CAALA,KADK,CAAP,CAGD,CACD,MAAO,CACLsD,UAAU,CAAEA,UADP,CAELC,OAAO,CAAEA,OAFJ,CAAP,CAID,CAAC,MAAOvD,KAAP,CAAmB,CACnB,MAAO,CACLA,KAAK,CAAE,yBAAYA,KAAZ,CADF,CAAP,CAGD,CACF,CArB8B,iBAAlBqD,CAAAA,kBAAkB,gDAAxB,C,8CAuBA,GAAMG,CAAAA,cAAc,sDAAG,UAAO5D,MAAP,CAEO,CACnC,GAAI,CACF,iCAA2CE,0BAAgB0D,cAAhB,CACzC5D,MADyC,CAA3C,CAAQ6D,UAAR,yBAAQA,UAAR,CAAoBlD,KAApB,yBAAoBA,KAApB,CAA2BP,KAA3B,yBAA2BA,KAA3B,CAIA,GAAIA,KAAJ,CAAW,CACT,MAAO,CACLA,KAAK,CAALA,KADK,CAAP,CAGD,CACD,MAAO,CACLyD,UAAU,CAAEA,UADP,CAELlD,KAAK,CAAEA,KAFF,CAAP,CAID,CAAC,MAAOP,KAAP,CAAmB,CACnB,MAAO,CACLA,KAAK,CAAE,yBAAYA,KAAZ,CADF,CAAP,CAGD,CACF,CAtB0B,iBAAdwD,CAAAA,cAAc,gDAApB,C,sCAwBA,GAAME,CAAAA,SAAS,CAAG5D,yBAAgB6D,YAAhB,EAAlB,C","sourcesContent":["import { isAndroid, isiOS, createError } from './helpers';\nimport { MissingRoutingNumber } from './types/Errors';\nimport NativeStripeSdk from './NativeStripeSdk';\nimport {\n ApplePay,\n ApplePayError,\n ApplePayResult,\n ConfirmPaymentResult,\n ConfirmPaymentSheetPaymentResult,\n SetupIntent,\n PaymentIntent,\n ConfirmSetupIntentResult,\n CreatePaymentMethodResult,\n CreateTokenForCVCUpdateResult,\n CreateTokenResult,\n GooglePayInitResult,\n HandleNextActionResult,\n InitPaymentSheetResult,\n PaymentMethod,\n PaymentSheet,\n PayWithGooglePayResult,\n PresentPaymentSheetResult,\n RetrievePaymentIntentResult,\n RetrieveSetupIntentResult,\n StripeError,\n GooglePay,\n CreateGooglePayPaymentMethodResult,\n OpenApplePaySetupResult,\n Token,\n VerifyMicrodepositsParams,\n VerifyMicrodepositsForPaymentResult,\n VerifyMicrodepositsForSetupResult,\n CollectBankAccountForPaymentResult,\n CollectBankAccountForSetupResult,\n IsCardInWalletResult,\n CanAddCardToWalletParams,\n CanAddCardToWalletResult,\n FinancialConnections,\n} from './types';\n\nconst APPLE_PAY_NOT_SUPPORTED_MESSAGE =\n 'Apple pay is not supported on this device';\n\nexport const createPaymentMethod = async (\n params: PaymentMethod.CreateParams,\n options: PaymentMethod.CreateOptions = {}\n): Promise<CreatePaymentMethodResult> => {\n try {\n const { paymentMethod, error } = await NativeStripeSdk.createPaymentMethod(\n params,\n options\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentMethod: paymentMethod!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const createToken = async (\n params: Token.CreateParams\n): Promise<CreateTokenResult> => {\n if (\n params.type === 'BankAccount' &&\n params.country?.toLowerCase() === 'us' &&\n !params.routingNumber\n ) {\n return {\n error: MissingRoutingNumber,\n };\n }\n\n try {\n const { token, error } = await NativeStripeSdk.createToken(params);\n\n if (error) {\n return {\n error,\n };\n }\n return {\n token: token!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const retrievePaymentIntent = async (\n clientSecret: string\n): Promise<RetrievePaymentIntentResult> => {\n try {\n const { paymentIntent, error } =\n await NativeStripeSdk.retrievePaymentIntent(clientSecret);\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const retrieveSetupIntent = async (\n clientSecret: string\n): Promise<RetrieveSetupIntentResult> => {\n try {\n const { setupIntent, error } = await NativeStripeSdk.retrieveSetupIntent(\n clientSecret\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n setupIntent: setupIntent!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\n/**\n * Confirm and, if necessary, authenticate a PaymentIntent.\n *\n * @param paymentIntentClientSecret The client_secret of the associated [PaymentIntent](https://stripe.com/docs/api/payment_intents).\n * @param params An optional object that contains data related to the payment method used to confirm this payment. If no object is provided (undefined), then it is assumed that the payment method has already been [attached to the Payment Intent](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method).\n * @param options An optional object that contains options for this payment method.\n * @returns A promise that resolves to an object containing either a `paymentIntent` field, or an `error` field.\n */\nexport const confirmPayment = async (\n paymentIntentClientSecret: string,\n params?: PaymentIntent.ConfirmParams,\n options: PaymentIntent.ConfirmOptions = {}\n): Promise<ConfirmPaymentResult> => {\n try {\n const { paymentIntent, error } = await NativeStripeSdk.confirmPayment(\n paymentIntentClientSecret,\n params,\n options\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const isApplePaySupported = async (): Promise<boolean> => {\n return isiOS && (await NativeStripeSdk.isApplePaySupported());\n};\n\nexport const presentApplePay = async (\n params: ApplePay.PresentParams\n): Promise<ApplePayResult> => {\n if (!(await NativeStripeSdk.isApplePaySupported())) {\n return {\n error: {\n code: ApplePayError.Canceled,\n message: APPLE_PAY_NOT_SUPPORTED_MESSAGE,\n },\n };\n }\n\n try {\n const { paymentMethod, error } = await NativeStripeSdk.presentApplePay(\n params\n );\n if (error) {\n return {\n error,\n };\n }\n return { paymentMethod: paymentMethod! };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const updateApplePaySummaryItems = async (\n summaryItems: ApplePay.CartSummaryItem[],\n errorAddressFields: Array<{\n field: ApplePay.AddressFields;\n message?: string;\n }> = []\n): Promise<{ error?: StripeError<ApplePayError> }> => {\n if (!(await NativeStripeSdk.isApplePaySupported())) {\n return {\n error: {\n code: ApplePayError.Canceled,\n message: APPLE_PAY_NOT_SUPPORTED_MESSAGE,\n },\n };\n }\n\n try {\n await NativeStripeSdk.updateApplePaySummaryItems(\n summaryItems,\n errorAddressFields\n );\n\n return {};\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const confirmApplePayPayment = async (\n clientSecret: string\n): Promise<{ error?: StripeError<ApplePayError> }> => {\n if (!(await NativeStripeSdk.isApplePaySupported())) {\n return {\n error: {\n code: ApplePayError.Canceled,\n message: APPLE_PAY_NOT_SUPPORTED_MESSAGE,\n },\n };\n }\n try {\n await NativeStripeSdk.confirmApplePayPayment(clientSecret);\n return {};\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const handleNextAction = async (\n paymentIntentClientSecret: string\n): Promise<HandleNextActionResult> => {\n try {\n const { paymentIntent, error } = await NativeStripeSdk.handleNextAction(\n paymentIntentClientSecret\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const confirmSetupIntent = async (\n paymentIntentClientSecret: string,\n params: SetupIntent.ConfirmParams,\n options: SetupIntent.ConfirmOptions = {}\n): Promise<ConfirmSetupIntentResult> => {\n try {\n const { setupIntent, error } = await NativeStripeSdk.confirmSetupIntent(\n paymentIntentClientSecret,\n params,\n options\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n setupIntent: setupIntent!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const createTokenForCVCUpdate = async (\n cvc: string\n): Promise<CreateTokenForCVCUpdateResult> => {\n try {\n const { tokenId, error } = await NativeStripeSdk.createTokenForCVCUpdate(\n cvc\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n tokenId: tokenId!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const handleURLCallback = async (url: string): Promise<boolean> => {\n const stripeHandled = await NativeStripeSdk.handleURLCallback(url);\n return stripeHandled;\n};\n\nexport const verifyMicrodepositsForPayment = async (\n clientSecret: string,\n params: VerifyMicrodepositsParams\n): Promise<VerifyMicrodepositsForPaymentResult> => {\n try {\n const { paymentIntent, error } = (await NativeStripeSdk.verifyMicrodeposits(\n true,\n clientSecret,\n params\n )) as VerifyMicrodepositsForPaymentResult;\n\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const verifyMicrodepositsForSetup = async (\n clientSecret: string,\n params: VerifyMicrodepositsParams\n): Promise<VerifyMicrodepositsForSetupResult> => {\n try {\n const { setupIntent, error } = (await NativeStripeSdk.verifyMicrodeposits(\n false,\n clientSecret,\n params\n )) as VerifyMicrodepositsForSetupResult;\n\n if (error) {\n return {\n error,\n };\n }\n return {\n setupIntent: setupIntent!,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const initPaymentSheet = async (\n params: PaymentSheet.SetupParams\n): Promise<InitPaymentSheetResult> => {\n try {\n const { paymentOption, error } = await NativeStripeSdk.initPaymentSheet(\n params\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentOption,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const presentPaymentSheet =\n async (): Promise<PresentPaymentSheetResult> => {\n try {\n const { paymentOption, error } =\n await NativeStripeSdk.presentPaymentSheet();\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentOption: paymentOption!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n };\n\nexport const confirmPaymentSheetPayment =\n async (): Promise<ConfirmPaymentSheetPaymentResult> => {\n try {\n const { error } = await NativeStripeSdk.confirmPaymentSheetPayment();\n if (error) {\n return {\n error,\n };\n }\n return {};\n } catch (error: any) {\n return {\n error,\n };\n }\n };\n\nexport const isGooglePaySupported = async (\n params?: GooglePay.IsSupportedParams\n): Promise<boolean> => {\n return (\n isAndroid && (await NativeStripeSdk.isGooglePaySupported(params ?? {}))\n );\n};\n\nexport const initGooglePay = async (\n params: GooglePay.InitParams\n): Promise<GooglePayInitResult> => {\n try {\n const { error } = await NativeStripeSdk.initGooglePay(params);\n if (error) {\n return {\n error,\n };\n }\n return {};\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const presentGooglePay = async (\n params: GooglePay.PresentParams\n): Promise<PayWithGooglePayResult> => {\n try {\n const { error } = await NativeStripeSdk.presentGooglePay(params);\n if (error) {\n return {\n error,\n };\n }\n return {};\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const createGooglePayPaymentMethod = async (\n params: GooglePay.CreatePaymentMethodParams\n): Promise<CreateGooglePayPaymentMethodResult> => {\n try {\n const { error, paymentMethod } =\n await NativeStripeSdk.createGooglePayPaymentMethod(params);\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentMethod: paymentMethod!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const openApplePaySetup = async (): Promise<OpenApplePaySetupResult> => {\n try {\n const { error } = await NativeStripeSdk.openApplePaySetup();\n if (error) {\n return {\n error,\n };\n }\n return {};\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const collectBankAccountForPayment = async (\n clientSecret: string,\n params: PaymentMethod.CollectBankAccountParams\n): Promise<CollectBankAccountForPaymentResult> => {\n try {\n const { paymentIntent, error } = (await NativeStripeSdk.collectBankAccount(\n true,\n clientSecret,\n params\n )) as CollectBankAccountForPaymentResult;\n\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const collectBankAccountForSetup = async (\n clientSecret: string,\n params: PaymentMethod.CollectBankAccountParams\n): Promise<CollectBankAccountForSetupResult> => {\n try {\n const { setupIntent, error } = (await NativeStripeSdk.collectBankAccount(\n false,\n clientSecret,\n params\n )) as CollectBankAccountForSetupResult;\n\n if (error) {\n return {\n error,\n };\n }\n return {\n setupIntent: setupIntent!,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\n/**\n * Use collectBankAccountToken in the [Add a Financial Connections Account to a US Custom Connect](https://stripe.com/docs/financial-connections/connect-payouts) account flow.\n * When called, it will load the Authentication Flow, an on-page modal UI which allows your user to securely link their external financial account for payouts.\n * @param clientSecret The client_secret of the [Financial Connections Session](https://stripe.com/docs/api/financial_connections/session).\n * @returns A promise that resolves to an object containing either `session` and `token` fields, or an error field.\n */\nexport const collectBankAccountToken = async (\n clientSecret: string\n): Promise<FinancialConnections.TokenResult> => {\n try {\n const { session, token, error } =\n await NativeStripeSdk.collectBankAccountToken(clientSecret);\n\n if (error) {\n return {\n error,\n };\n }\n return {\n session: session!,\n token: token!,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\n/**\n * Use collectFinancialConnectionsAccounts in the [Collect an account to build data-powered products](https://stripe.com/docs/financial-connections/other-data-powered-products) flow.\n * When called, it will load the Authentication Flow, an on-page modal UI which allows your user to securely link their external financial account.\n * @param clientSecret The client_secret of the [Financial Connections Session](https://stripe.com/docs/api/financial_connections/session).\n * @returns A promise that resolves to an object containing either a `session` field, or an error field.\n */\nexport const collectFinancialConnectionsAccounts = async (\n clientSecret: string\n): Promise<FinancialConnections.SessionResult> => {\n try {\n const { session, error } =\n await NativeStripeSdk.collectFinancialConnectionsAccounts(clientSecret);\n\n if (error) {\n return {\n error,\n };\n }\n return {\n session: session!,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const canAddCardToWallet = async (\n params: CanAddCardToWalletParams\n): Promise<CanAddCardToWalletResult> => {\n try {\n const { canAddCard, details, error } =\n await NativeStripeSdk.canAddCardToWallet(params);\n\n if (error) {\n return {\n error,\n };\n }\n return {\n canAddCard: canAddCard as boolean,\n details: details,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const isCardInWallet = async (params: {\n cardLastFour: string;\n}): Promise<IsCardInWalletResult> => {\n try {\n const { isInWallet, token, error } = await NativeStripeSdk.isCardInWallet(\n params\n );\n\n if (error) {\n return {\n error,\n };\n }\n return {\n isInWallet: isInWallet as boolean,\n token: token,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const Constants = NativeStripeSdk.getConstants();\n"]}
@@ -1,2 +1,2 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useApplePay=useApplePay;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=require("react");var _useStripe2=require("./useStripe");var _reactNative=require("react-native");var eventEmitter=new _reactNative.NativeEventEmitter(_reactNative.NativeModules.StripeSdk);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 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 _callee(params){var result;return _regenerator.default.async(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:setLoading(true);setItems(params.cartItems);_context.next=4;return _regenerator.default.awrap(_presentApplePay(params));case 4:result=_context.sent;if(result.error){setItems(null);}setLoading(false);return _context.abrupt("return",result);case 8:case"end":return _context.stop();}}},null,null,null,Promise);},[_presentApplePay]);var openApplePaySetup=(0,_react.useCallback)(function _callee2(){var result;return _regenerator.default.async(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:setLoading(true);_context2.next=3;return _regenerator.default.awrap(_openApplePaySetup());case 3:result=_context2.sent;setLoading(false);return _context2.abrupt("return",result);case 6:case"end":return _context2.stop();}}},null,null,null,Promise);},[_openApplePaySetup]);var confirmApplePayPayment=(0,_react.useCallback)(function _callee3(clientSecret){var result;return _regenerator.default.async(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:setLoading(true);_context3.next=3;return _regenerator.default.awrap(_confirmApplePayPayment(clientSecret));case 3:result=_context3.sent;setItems(null);setLoading(false);return _context3.abrupt("return",result);case 7:case"end":return _context3.stop();}}},null,null,null,Promise);},[_confirmApplePayPayment]);return{loading:loading,presentApplePay:presentApplePay,confirmApplePayPayment:confirmApplePayPayment,isApplePaySupported:isApplePaySupported,openApplePaySetup:openApplePaySetup};}
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 eventEmitter=new _reactNative.NativeEventEmitter(_reactNative.NativeModules.StripeSdk);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 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
2
  //# sourceMappingURL=useApplePay.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["useApplePay.tsx"],"names":["eventEmitter","NativeEventEmitter","NativeModules","StripeSdk","SET_SHIPPING_METHOD_CALLBACK_NAME","SET_SHIPPING_CONTACT_CALLBACK_NAME","useApplePay","onShippingMethodSelected","onShippingContactSelected","isApplePaySupported","_presentApplePay","presentApplePay","_confirmApplePayPayment","confirmApplePayPayment","updateApplePaySummaryItems","_openApplePaySetup","openApplePaySetup","items","setItems","loading","setLoading","onDidSetShippingMethod","result","shippingMethod","onDidSetShippingContact","shippingContact","didSetShippingMethodListener","addListener","didSetShippingContactListener","remove","params","cartItems","error","clientSecret"],"mappings":"uVACA,4BACA,uCACA,yCAEA,GAAMA,CAAAA,YAAY,CAAG,GAAIC,gCAAJ,CAAuBC,2BAAcC,SAArC,CAArB,CAqDA,GAAMC,CAAAA,iCAAiC,CAAG,wBAA1C,CACA,GAAMC,CAAAA,kCAAkC,CAAG,yBAA3C,CAKO,QAASC,CAAAA,WAAT,EAGQ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ID,CAdD,CAcG,CAACL,uBAAD,CAA0BH,sBAA1B,CAdH,EAgBA,GAAMV,CAAAA,eAAe,CAAG,uBACtB,iBAAOmB,MAAP,+HACEV,UAAU,CAAC,IAAD,CAAV,CACAF,QAAQ,CAACY,MAAM,CAACC,SAAR,CAAR,CAFF,kDAGuBrB,gBAAgB,CAACoB,MAAD,CAHvC,SAGQR,MAHR,eAIE,GAAIA,MAAM,CAACU,KAAX,CAAkB,CAChBd,QAAQ,CAAC,IAAD,CAAR,CACD,CACDE,UAAU,CAAC,KAAD,CAAV,CAPF,gCAQSE,MART,uEADsB,CAWtB,CAACZ,gBAAD,CAXsB,CAAxB,CAcA,GAAMM,CAAAA,iBAAiB,CAAG,uBAAY,qJACpCI,UAAU,CAAC,IAAD,CAAV,CADoC,mDAEfL,kBAAkB,EAFH,SAE9BO,MAF8B,gBAGpCF,UAAU,CAAC,KAAD,CAAV,CAHoC,iCAI7BE,MAJ6B,wEAAZ,CAKvB,CAACP,kBAAD,CALuB,CAA1B,CAOA,GAAMF,CAAAA,sBAAsB,CAAG,uBAC7B,kBAAOoB,YAAP,mIACEb,UAAU,CAAC,IAAD,CAAV,CADF,mDAEuBR,uBAAuB,CAACqB,YAAD,CAF9C,SAEQX,MAFR,gBAGEJ,QAAQ,CAAC,IAAD,CAAR,CACAE,UAAU,CAAC,KAAD,CAAV,CAJF,iCAKSE,MALT,wEAD6B,CAQ7B,CAACV,uBAAD,CAR6B,CAA/B,CAWA,MAAO,CACLO,OAAO,CAAPA,OADK,CAELR,eAAe,CAAfA,eAFK,CAGLE,sBAAsB,CAAtBA,sBAHK,CAILJ,mBAAmB,CAAnBA,mBAJK,CAKLO,iBAAiB,CAAjBA,iBALK,CAAP,CAOD","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\nconst eventEmitter = new NativeEventEmitter(NativeModules.StripeSdk);\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 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"]}
1
+ {"version":3,"sources":["useApplePay.tsx"],"names":["eventEmitter","NativeEventEmitter","NativeModules","StripeSdk","SET_SHIPPING_METHOD_CALLBACK_NAME","SET_SHIPPING_CONTACT_CALLBACK_NAME","useApplePay","onShippingMethodSelected","onShippingContactSelected","isApplePaySupported","_presentApplePay","presentApplePay","_confirmApplePayPayment","confirmApplePayPayment","updateApplePaySummaryItems","_openApplePaySetup","openApplePaySetup","items","setItems","loading","setLoading","onDidSetShippingMethod","result","shippingMethod","onDidSetShippingContact","shippingContact","didSetShippingMethodListener","addListener","didSetShippingContactListener","remove","params","cartItems","error","clientSecret"],"mappings":"0WACA,4BACA,uCACA,yCAEA,GAAMA,CAAAA,YAAY,CAAG,GAAIC,gCAAJ,CAAuBC,2BAAcC,SAArC,CAArB,CAqDA,GAAMC,CAAAA,iCAAiC,CAAG,wBAA1C,CACA,GAAMC,CAAAA,kCAAkC,CAAG,yBAA3C,CAKO,QAASC,CAAAA,WAAT,EAGQ,oEAAJ,EAAI,CAFbC,wBAEa,MAFbA,wBAEa,CADbC,yBACa,MADbA,yBACa,CACb,eAMI,2BANJ,CACEC,mBADF,YACEA,mBADF,CAEmBC,gBAFnB,YAEEC,eAFF,CAG0BC,uBAH1B,YAGEC,sBAHF,CAIEC,0BAJF,YAIEA,0BAJF,CAKqBC,kBALrB,YAKEC,iBALF,CAOA,cAA0B,oBAA4C,IAA5C,CAA1B,qDAAOC,KAAP,eAAcC,QAAd,eACA,eAA8B,oBAAS,KAAT,CAA9B,sDAAOC,OAAP,eAAgBC,UAAhB,eAEA,GAAMC,CAAAA,sBAAsB,CAAG,uBAC7B,SAACC,MAAD,CAAyD,CACvD,GAAIf,wBAAJ,CAA8B,CAC5BA,wBAAwB,CACtBe,MAAM,CAACC,cADe,CAEtBT,0BAFsB,CAAxB,CAID,CALD,IAKO,CACLA,0BAA0B,CAACG,KAAD,CAA1B,CACD,CACF,CAV4B,CAW7B,CAACA,KAAD,CAAQV,wBAAR,CAAkCO,0BAAlC,CAX6B,CAA/B,CAcA,GAAMU,CAAAA,uBAAuB,CAAG,uBAC9B,SAACF,MAAD,CAA2D,CACzD,GAAId,yBAAJ,CAA+B,CAC7BA,yBAAyB,CACvBc,MAAM,CAACG,eADgB,CAEvBX,0BAFuB,CAAzB,CAID,CALD,IAKO,CACLA,0BAA0B,CAACG,KAAD,CAA1B,CACD,CACF,CAV6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ACAE,UAAU,CAAC,KAAD,CAAV,CACA,MAAOE,CAAAA,MAAP,CACD,CAP4B,gEAQ7B,CAACV,uBAAD,CAR6B,CAA/B,CAWA,MAAO,CACLO,OAAO,CAAPA,OADK,CAELR,eAAe,CAAfA,eAFK,CAGLE,sBAAsB,CAAtBA,sBAHK,CAILJ,mBAAmB,CAAnBA,mBAJK,CAKLO,iBAAiB,CAAjBA,iBALK,CAAP,CAOD","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\nconst eventEmitter = new NativeEventEmitter(NativeModules.StripeSdk);\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 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"]}
@@ -1,2 +1,2 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useConfirmPayment=useConfirmPayment;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=require("react");var _useStripe2=require("./useStripe");function useConfirmPayment(){var _useState=(0,_react.useState)(false),_useState2=(0,_slicedToArray2.default)(_useState,2),loading=_useState2[0],setLoading=_useState2[1];var _useStripe=(0,_useStripe2.useStripe)(),confirmPayment=_useStripe.confirmPayment;var _confirmPayment=(0,_react.useCallback)(function _callee(paymentIntentClientSecret,data){var options,result,_args=arguments;return _regenerator.default.async(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:options=_args.length>2&&_args[2]!==undefined?_args[2]:{};setLoading(true);_context.next=4;return _regenerator.default.awrap(confirmPayment(paymentIntentClientSecret,data,options));case 4:result=_context.sent;setLoading(false);return _context.abrupt("return",result);case 7:case"end":return _context.stop();}}},null,null,null,Promise);},[confirmPayment]);return{confirmPayment:_confirmPayment,loading:loading};}
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useConfirmPayment=useConfirmPayment;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 useConfirmPayment(){var _useState=(0,_react.useState)(false),_useState2=(0,_slicedToArray2.default)(_useState,2),loading=_useState2[0],setLoading=_useState2[1];var _useStripe=(0,_useStripe2.useStripe)(),confirmPayment=_useStripe.confirmPayment;var _confirmPayment=(0,_react.useCallback)(function(){var _ref=(0,_asyncToGenerator2.default)(function*(paymentIntentClientSecret,data){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};setLoading(true);var result=yield confirmPayment(paymentIntentClientSecret,data,options);setLoading(false);return result;});return function(_x,_x2){return _ref.apply(this,arguments);};}(),[confirmPayment]);return{confirmPayment:_confirmPayment,loading:loading};}
2
2
  //# sourceMappingURL=useConfirmPayment.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["useConfirmPayment.tsx"],"names":["useConfirmPayment","loading","setLoading","confirmPayment","_confirmPayment","paymentIntentClientSecret","data","options","result"],"mappings":"mWAAA,4BAEA,uCAKO,QAASA,CAAAA,iBAAT,EAA6B,CAClC,cAA8B,oBAAS,KAAT,CAA9B,qDAAOC,OAAP,eAAgBC,UAAhB,eACA,eAA2B,2BAA3B,CAAQC,cAAR,YAAQA,cAAR,CAEA,GAAMC,CAAAA,eAAe,CAAG,uBACtB,iBACEC,yBADF,CAEEC,IAFF,uJAGEC,OAHF,+CAG0C,EAH1C,CAKEL,UAAU,CAAC,IAAD,CAAV,CALF,kDAOuBC,cAAc,CACjCE,yBADiC,CAEjCC,IAFiC,CAGjCC,OAHiC,CAPrC,SAOQC,MAPR,eAaEN,UAAU,CAAC,KAAD,CAAV,CAbF,gCAeSM,MAfT,uEADsB,CAkBtB,CAACL,cAAD,CAlBsB,CAAxB,CAqBA,MAAO,CACLA,cAAc,CAAEC,eADX,CAELH,OAAO,CAAPA,OAFK,CAAP,CAID","sourcesContent":["import { useCallback, useState } from 'react';\nimport type { PaymentMethod } from '../types';\nimport { useStripe } from './useStripe';\n\n/**\n * useConfirmPayment hook\n */\nexport function useConfirmPayment() {\n const [loading, setLoading] = useState(false);\n const { confirmPayment } = useStripe();\n\n const _confirmPayment = useCallback(\n async (\n paymentIntentClientSecret: string,\n data: PaymentMethod.ConfirmParams,\n options: PaymentMethod.ConfirmOptions = {}\n ) => {\n setLoading(true);\n\n const result = await confirmPayment(\n paymentIntentClientSecret,\n data,\n options\n );\n\n setLoading(false);\n\n return result;\n },\n [confirmPayment]\n );\n\n return {\n confirmPayment: _confirmPayment,\n loading,\n };\n}\n"]}
1
+ {"version":3,"sources":["useConfirmPayment.tsx"],"names":["useConfirmPayment","loading","setLoading","confirmPayment","_confirmPayment","paymentIntentClientSecret","data","options","result"],"mappings":"sXAAA,4BAEA,uCAKO,QAASA,CAAAA,iBAAT,EAA6B,CAClC,cAA8B,oBAAS,KAAT,CAA9B,qDAAOC,OAAP,eAAgBC,UAAhB,eACA,eAA2B,2BAA3B,CAAQC,cAAR,YAAQA,cAAR,CAEA,GAAMC,CAAAA,eAAe,CAAG,0EACtB,UACEC,yBADF,CAEEC,IAFF,CAIK,IADHC,CAAAA,OACG,2DADqC,EACrC,CACHL,UAAU,CAAC,IAAD,CAAV,CAEA,GAAMM,CAAAA,MAAM,MAASL,CAAAA,cAAc,CACjCE,yBADiC,CAEjCC,IAFiC,CAGjCC,OAHiC,CAAnC,CAMAL,UAAU,CAAC,KAAD,CAAV,CAEA,MAAOM,CAAAA,MAAP,CACD,CAjBqB,kEAkBtB,CAACL,cAAD,CAlBsB,CAAxB,CAqBA,MAAO,CACLA,cAAc,CAAEC,eADX,CAELH,OAAO,CAAPA,OAFK,CAAP,CAID","sourcesContent":["import { useCallback, useState } from 'react';\nimport type { PaymentIntent } from '../types';\nimport { useStripe } from './useStripe';\n\n/**\n * useConfirmPayment hook\n */\nexport function useConfirmPayment() {\n const [loading, setLoading] = useState(false);\n const { confirmPayment } = useStripe();\n\n const _confirmPayment = useCallback(\n async (\n paymentIntentClientSecret: string,\n data?: PaymentIntent.ConfirmParams,\n options: PaymentIntent.ConfirmOptions = {}\n ) => {\n setLoading(true);\n\n const result = await confirmPayment(\n paymentIntentClientSecret,\n data,\n options\n );\n\n setLoading(false);\n\n return result;\n },\n [confirmPayment]\n );\n\n return {\n confirmPayment: _confirmPayment,\n loading,\n };\n}\n"]}
@@ -1,2 +1,2 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useConfirmSetupIntent=useConfirmSetupIntent;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=require("react");var _useStripe2=require("./useStripe");function useConfirmSetupIntent(){var _useState=(0,_react.useState)(false),_useState2=(0,_slicedToArray2.default)(_useState,2),loading=_useState2[0],setLoading=_useState2[1];var _useStripe=(0,_useStripe2.useStripe)(),confirmSetupIntent=_useStripe.confirmSetupIntent;var _confirmSetupIntent=(0,_react.useCallback)(function _callee(paymentIntentClientSecret,data){var options,result,_args=arguments;return _regenerator.default.async(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:options=_args.length>2&&_args[2]!==undefined?_args[2]:{};setLoading(true);_context.next=4;return _regenerator.default.awrap(confirmSetupIntent(paymentIntentClientSecret,data,options));case 4:result=_context.sent;setLoading(false);return _context.abrupt("return",result);case 7:case"end":return _context.stop();}}},null,null,null,Promise);},[confirmSetupIntent]);return{confirmSetupIntent:_confirmSetupIntent,loading:loading};}
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useConfirmSetupIntent=useConfirmSetupIntent;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 useConfirmSetupIntent(){var _useState=(0,_react.useState)(false),_useState2=(0,_slicedToArray2.default)(_useState,2),loading=_useState2[0],setLoading=_useState2[1];var _useStripe=(0,_useStripe2.useStripe)(),confirmSetupIntent=_useStripe.confirmSetupIntent;var _confirmSetupIntent=(0,_react.useCallback)(function(){var _ref=(0,_asyncToGenerator2.default)(function*(paymentIntentClientSecret,data){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};setLoading(true);var result=yield confirmSetupIntent(paymentIntentClientSecret,data,options);setLoading(false);return result;});return function(_x,_x2){return _ref.apply(this,arguments);};}(),[confirmSetupIntent]);return{confirmSetupIntent:_confirmSetupIntent,loading:loading};}
2
2
  //# sourceMappingURL=useConfirmSetupIntent.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["useConfirmSetupIntent.tsx"],"names":["useConfirmSetupIntent","loading","setLoading","confirmSetupIntent","_confirmSetupIntent","paymentIntentClientSecret","data","options","result"],"mappings":"2WAAA,4BAEA,uCAKO,QAASA,CAAAA,qBAAT,EAAiC,CACtC,cAA8B,oBAAS,KAAT,CAA9B,qDAAOC,OAAP,eAAgBC,UAAhB,eACA,eAAmD,2BAAnD,CAA4BC,kBAA5B,YAAQA,kBAAR,CAEA,GAAMC,CAAAA,mBAAmB,CAAG,uBAC1B,iBACEC,yBADF,CAEEC,IAFF,uJAGEC,OAHF,+CAGwC,EAHxC,CAKEL,UAAU,CAAC,IAAD,CAAV,CALF,kDAOuBC,kBAAkB,CACrCE,yBADqC,CAErCC,IAFqC,CAGrCC,OAHqC,CAPzC,SAOQC,MAPR,eAaEN,UAAU,CAAC,KAAD,CAAV,CAbF,gCAeSM,MAfT,uEAD0B,CAkB1B,CAACL,kBAAD,CAlB0B,CAA5B,CAqBA,MAAO,CACLA,kBAAkB,CAAEC,mBADf,CAELH,OAAO,CAAPA,OAFK,CAAP,CAID","sourcesContent":["import { useCallback, useState } from 'react';\nimport type { SetupIntent } from '../types';\nimport { useStripe } from './useStripe';\n\n/**\n * useConfirmSetupIntent hook\n */\nexport function useConfirmSetupIntent() {\n const [loading, setLoading] = useState(false);\n const { confirmSetupIntent: confirmSetupIntent } = useStripe();\n\n const _confirmSetupIntent = useCallback(\n async (\n paymentIntentClientSecret: string,\n data: SetupIntent.ConfirmParams,\n options: SetupIntent.ConfirmOptions = {}\n ) => {\n setLoading(true);\n\n const result = await confirmSetupIntent(\n paymentIntentClientSecret,\n data,\n options\n );\n\n setLoading(false);\n\n return result;\n },\n [confirmSetupIntent]\n );\n\n return {\n confirmSetupIntent: _confirmSetupIntent,\n loading,\n };\n}\n"]}
1
+ {"version":3,"sources":["useConfirmSetupIntent.tsx"],"names":["useConfirmSetupIntent","loading","setLoading","confirmSetupIntent","_confirmSetupIntent","paymentIntentClientSecret","data","options","result"],"mappings":"8XAAA,4BAEA,uCAKO,QAASA,CAAAA,qBAAT,EAAiC,CACtC,cAA8B,oBAAS,KAAT,CAA9B,qDAAOC,OAAP,eAAgBC,UAAhB,eACA,eAAmD,2BAAnD,CAA4BC,kBAA5B,YAAQA,kBAAR,CAEA,GAAMC,CAAAA,mBAAmB,CAAG,0EAC1B,UACEC,yBADF,CAEEC,IAFF,CAIK,IADHC,CAAAA,OACG,2DADmC,EACnC,CACHL,UAAU,CAAC,IAAD,CAAV,CAEA,GAAMM,CAAAA,MAAM,MAASL,CAAAA,kBAAkB,CACrCE,yBADqC,CAErCC,IAFqC,CAGrCC,OAHqC,CAAvC,CAMAL,UAAU,CAAC,KAAD,CAAV,CAEA,MAAOM,CAAAA,MAAP,CACD,CAjByB,kEAkB1B,CAACL,kBAAD,CAlB0B,CAA5B,CAqBA,MAAO,CACLA,kBAAkB,CAAEC,mBADf,CAELH,OAAO,CAAPA,OAFK,CAAP,CAID","sourcesContent":["import { useCallback, useState } from 'react';\nimport type { SetupIntent } from '../types';\nimport { useStripe } from './useStripe';\n\n/**\n * useConfirmSetupIntent hook\n */\nexport function useConfirmSetupIntent() {\n const [loading, setLoading] = useState(false);\n const { confirmSetupIntent: confirmSetupIntent } = useStripe();\n\n const _confirmSetupIntent = useCallback(\n async (\n paymentIntentClientSecret: string,\n data: SetupIntent.ConfirmParams,\n options: SetupIntent.ConfirmOptions = {}\n ) => {\n setLoading(true);\n\n const result = await confirmSetupIntent(\n paymentIntentClientSecret,\n data,\n options\n );\n\n setLoading(false);\n\n return result;\n },\n [confirmSetupIntent]\n );\n\n return {\n confirmSetupIntent: _confirmSetupIntent,\n loading,\n };\n}\n"]}
@@ -0,0 +1,2 @@
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useFinancialConnectionsSheet=useFinancialConnectionsSheet;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 useFinancialConnectionsSheet(){var _useState=(0,_react.useState)(false),_useState2=(0,_slicedToArray2.default)(_useState,2),loading=_useState2[0],setLoading=_useState2[1];var _useStripe=(0,_useStripe2.useStripe)(),collectBankAccountToken=_useStripe.collectBankAccountToken,collectFinancialConnectionsAccounts=_useStripe.collectFinancialConnectionsAccounts;var _collectBankAccountToken=function(){var _ref=(0,_asyncToGenerator2.default)(function*(clientSecret){setLoading(true);var result=yield collectBankAccountToken(clientSecret);setLoading(false);return result;});return function _collectBankAccountToken(_x){return _ref.apply(this,arguments);};}();var _collectFinancialConnectionsAccounts=function(){var _ref2=(0,_asyncToGenerator2.default)(function*(clientSecret){setLoading(true);var result=yield collectFinancialConnectionsAccounts(clientSecret);setLoading(false);return result;});return function _collectFinancialConnectionsAccounts(_x2){return _ref2.apply(this,arguments);};}();return{collectBankAccountToken:_collectBankAccountToken,collectFinancialConnectionsAccounts:_collectFinancialConnectionsAccounts,loading:loading};}
2
+ //# sourceMappingURL=useFinancialConnectionsSheet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useFinancialConnectionsSheet.tsx"],"names":["useFinancialConnectionsSheet","loading","setLoading","collectBankAccountToken","collectFinancialConnectionsAccounts","_collectBankAccountToken","clientSecret","result","_collectFinancialConnectionsAccounts"],"mappings":"4YAAA,4BACA,uCAQO,QAASA,CAAAA,4BAAT,EAAwC,CAC7C,cAA8B,oBAAS,KAAT,CAA9B,qDAAOC,OAAP,eAAgBC,UAAhB,eACA,eACE,2BADF,CAAQC,uBAAR,YAAQA,uBAAR,CAAiCC,mCAAjC,YAAiCA,mCAAjC,CAGA,GAAMC,CAAAA,wBAAwB,oDAAG,UAAOC,YAAP,CAAgC,CAC/DJ,UAAU,CAAC,IAAD,CAAV,CACA,GAAMK,CAAAA,MAAM,MAASJ,CAAAA,uBAAuB,CAACG,YAAD,CAA5C,CACAJ,UAAU,CAAC,KAAD,CAAV,CACA,MAAOK,CAAAA,MAAP,CACD,CAL6B,iBAAxBF,CAAAA,wBAAwB,4CAA9B,CAOA,GAAMG,CAAAA,oCAAoC,qDAAG,UAAOF,YAAP,CAAgC,CAC3EJ,UAAU,CAAC,IAAD,CAAV,CACA,GAAMK,CAAAA,MAAM,MAASH,CAAAA,mCAAmC,CAACE,YAAD,CAAxD,CACAJ,UAAU,CAAC,KAAD,CAAV,CACA,MAAOK,CAAAA,MAAP,CACD,CALyC,iBAApCC,CAAAA,oCAAoC,8CAA1C,CAOA,MAAO,CACLL,uBAAuB,CAAEE,wBADpB,CAELD,mCAAmC,CAAEI,oCAFhC,CAGLP,OAAO,CAAPA,OAHK,CAAP,CAKD","sourcesContent":["import { useState } from 'react';\nimport { useStripe } from './useStripe';\n\n/**\n * React hook for accessing functions on the Financial Connections sheet.\n *\n * Retuns the `collectBankAccountToken` and `collectFinancialConnectionsAccounts` functions, and a `loading` boolean that you can use\n * to display loading state (like showing a spinner).\n */\nexport function useFinancialConnectionsSheet() {\n const [loading, setLoading] = useState(false);\n const { collectBankAccountToken, collectFinancialConnectionsAccounts } =\n useStripe();\n\n const _collectBankAccountToken = async (clientSecret: string) => {\n setLoading(true);\n const result = await collectBankAccountToken(clientSecret);\n setLoading(false);\n return result;\n };\n\n const _collectFinancialConnectionsAccounts = async (clientSecret: string) => {\n setLoading(true);\n const result = await collectFinancialConnectionsAccounts(clientSecret);\n setLoading(false);\n return result;\n };\n\n return {\n collectBankAccountToken: _collectBankAccountToken,\n collectFinancialConnectionsAccounts: _collectFinancialConnectionsAccounts,\n loading,\n };\n}\n"]}
@@ -1,2 +1,2 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useGooglePay=useGooglePay;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));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 _callee(params){var result;return _regenerator.default.async(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:setLoading(true);_context.next=3;return _regenerator.default.awrap(isGooglePaySupported(params));case 3:result=_context.sent;setLoading(false);return _context.abrupt("return",result);case 6:case"end":return _context.stop();}}},null,null,null,Promise);},[isGooglePaySupported]);var _initGooglePay=(0,_react.useCallback)(function _callee2(params){var result;return _regenerator.default.async(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:setLoading(true);_context2.next=3;return _regenerator.default.awrap(initGooglePay(params));case 3:result=_context2.sent;setLoading(false);return _context2.abrupt("return",result);case 6:case"end":return _context2.stop();}}},null,null,null,Promise);},[initGooglePay]);var _presentGooglePay=(0,_react.useCallback)(function _callee3(params){var result;return _regenerator.default.async(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:setLoading(true);_context3.next=3;return _regenerator.default.awrap(presentGooglePay(params));case 3:result=_context3.sent;setLoading(false);return _context3.abrupt("return",result);case 6:case"end":return _context3.stop();}}},null,null,null,Promise);},[presentGooglePay]);var _createGooglePayPaymentMethod=(0,_react.useCallback)(function _callee4(params){var result;return _regenerator.default.async(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:setLoading(true);_context4.next=3;return _regenerator.default.awrap(createGooglePayPaymentMethod(params));case 3:result=_context4.sent;setLoading(false);return _context4.abrupt("return",result);case 6:case"end":return _context4.stop();}}},null,null,null,Promise);},[createGooglePayPaymentMethod]);return{loading:loading,isGooglePaySupported:_isGooglePaySupported,initGooglePay:_initGooglePay,presentGooglePay:_presentGooglePay,createGooglePayPaymentMethod:_createGooglePayPaymentMethod};}
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
2
  //# sourceMappingURL=useGooglePay.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["useGooglePay.tsx"],"names":["useGooglePay","isGooglePaySupported","initGooglePay","presentGooglePay","createGooglePayPaymentMethod","loading","setLoading","_isGooglePaySupported","params","result","_initGooglePay","_presentGooglePay","_createGooglePayPaymentMethod"],"mappings":"yVAAA,4BAEA,uCAKO,QAASA,CAAAA,YAAT,EAAwB,CAC7B,eAKI,2BALJ,CACEC,oBADF,YACEA,oBADF,CAEEC,aAFF,YAEEA,aAFF,CAGEC,gBAHF,YAGEA,gBAHF,CAIEC,4BAJF,YAIEA,4BAJF,CAMA,cAA8B,oBAAS,KAAT,CAA9B,qDAAOC,OAAP,eAAgBC,UAAhB,eAEA,GAAMC,CAAAA,qBAAqB,CAAG,uBAC5B,iBAAOC,MAAP,+HACEF,UAAU,CAAC,IAAD,CAAV,CADF,kDAGuBL,oBAAoB,CAACO,MAAD,CAH3C,SAGQC,MAHR,eAIEH,UAAU,CAAC,KAAD,CAAV,CAJF,gCAMSG,MANT,uEAD4B,CAS5B,CAACR,oBAAD,CAT4B,CAA9B,CAYA,GAAMS,CAAAA,cAAc,CAAG,uBACrB,kBAAOF,MAAP,mIACEF,UAAU,CAAC,IAAD,CAAV,CADF,mDAGuBJ,aAAa,CAACM,MAAD,CAHpC,SAGQC,MAHR,gBAIEH,UAAU,CAAC,KAAD,CAAV,CAJF,iCAMSG,MANT,wEADqB,CASrB,CAACP,aAAD,CATqB,CAAvB,CAYA,GAAMS,CAAAA,iBAAiB,CAAG,uBACxB,kBAAOH,MAAP,mIACEF,UAAU,CAAC,IAAD,CAAV,CADF,mDAGuBH,gBAAgB,CAACK,MAAD,CAHvC,SAGQC,MAHR,gBAIEH,UAAU,CAAC,KAAD,CAAV,CAJF,iCAMSG,MANT,wEADwB,CASxB,CAACN,gBAAD,CATwB,CAA1B,CAYA,GAAMS,CAAAA,6BAA6B,CAAG,uBACpC,kBAAOJ,MAAP,mIACEF,UAAU,CAAC,IAAD,CAAV,CADF,mDAGuBF,4BAA4B,CAACI,MAAD,CAHnD,SAGQC,MAHR,gBAIEH,UAAU,CAAC,KAAD,CAAV,CAJF,iCAMSG,MANT,wEADoC,CASpC,CAACL,4BAAD,CAToC,CAAtC,CAYA,MAAO,CACLC,OAAO,CAAPA,OADK,CAELJ,oBAAoB,CAAEM,qBAFjB,CAGLL,aAAa,CAAEQ,cAHV,CAILP,gBAAgB,CAAEQ,iBAJb,CAKLP,4BAA4B,CAAEQ,6BALzB,CAAP,CAOD","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"]}
1
+ {"version":3,"sources":["useGooglePay.tsx"],"names":["useGooglePay","isGooglePaySupported","initGooglePay","presentGooglePay","createGooglePayPaymentMethod","loading","setLoading","_isGooglePaySupported","params","result","_initGooglePay","_presentGooglePay","_createGooglePayPaymentMethod"],"mappings":"4WAAA,4BAEA,uCAKO,QAASA,CAAAA,YAAT,EAAwB,CAC7B,eAKI,2BALJ,CACEC,oBADF,YACEA,oBADF,CAEEC,aAFF,YAEEA,aAFF,CAGEC,gBAHF,YAGEA,gBAHF,CAIEC,4BAJF,YAIEA,4BAJF,CAMA,cAA8B,oBAAS,KAAT,CAA9B,qDAAOC,OAAP,eAAgBC,UAAhB,eAEA,GAAMC,CAAAA,qBAAqB,CAAG,0EAC5B,UAAOC,MAAP,CAAgD,CAC9CF,UAAU,CAAC,IAAD,CAAV,CAEA,GAAMG,CAAAA,MAAM,MAASR,CAAAA,oBAAoB,CAACO,MAAD,CAAzC,CACAF,UAAU,CAAC,KAAD,CAAV,CAEA,MAAOG,CAAAA,MAAP,CACD,CAR2B,8DAS5B,CAACR,oBAAD,CAT4B,CAA9B,CAYA,GAAMS,CAAAA,cAAc,CAAG,2EACrB,UAAOF,MAAP,CAAwC,CACtCF,UAAU,CAAC,IAAD,CAAV,CAEA,GAAMG,CAAAA,MAAM,MAASP,CAAAA,aAAa,CAACM,MAAD,CAAlC,CACAF,UAAU,CAAC,KAAD,CAAV,CAEA,MAAOG,CAAAA,MAAP,CACD,CARoB,gEASrB,CAACP,aAAD,CATqB,CAAvB,CAYA,GAAMS,CAAAA,iBAAiB,CAAG,2EACxB,UAAOH,MAAP,CAA2C,CACzCF,UAAU,CAAC,IAAD,CAAV,CAEA,GAAMG,CAAAA,MAAM,MAASN,CAAAA,gBAAgB,CAACK,MAAD,CAArC,CACAF,UAAU,CAAC,KAAD,CAAV,CAEA,MAAOG,CAAAA,MAAP,CACD,CARuB,gEASxB,CAACN,gBAAD,CATwB,CAA1B,CAYA,GAAMS,CAAAA,6BAA6B,CAAG,2EACpC,UAAOJ,MAAP,CAAuD,CACrDF,UAAU,CAAC,IAAD,CAAV,CAEA,GAAMG,CAAAA,MAAM,MAASL,CAAAA,4BAA4B,CAACI,MAAD,CAAjD,CACAF,UAAU,CAAC,KAAD,CAAV,CAEA,MAAOG,CAAAA,MAAP,CACD,CARmC,gEASpC,CAACL,4BAAD,CAToC,CAAtC,CAYA,MAAO,CACLC,OAAO,CAAPA,OADK,CAELJ,oBAAoB,CAAEM,qBAFjB,CAGLL,aAAa,CAAEQ,cAHV,CAILP,gBAAgB,CAAEQ,iBAJb,CAKLP,4BAA4B,CAAEQ,6BALzB,CAAP,CAOD","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"]}