@stripe/stripe-react-native 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +2 -2
  3. package/android/src/main/java/com/reactnativestripesdk/CardChangedEvent.kt +1 -0
  4. package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +3 -0
  5. package/android/src/main/java/com/reactnativestripesdk/CardFormCompleteEvent.kt +1 -0
  6. package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +1 -0
  7. package/android/src/main/java/com/reactnativestripesdk/CollectBankAccountLauncherFragment.kt +1 -1
  8. package/android/src/main/java/com/reactnativestripesdk/GooglePayPaymentMethodLauncherFragment.kt +1 -1
  9. package/android/src/main/java/com/reactnativestripesdk/Mappers.kt +22 -22
  10. package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +36 -5
  11. package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +38 -15
  12. package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonManager.kt +3 -8
  13. package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonView.kt +6 -10
  14. package/ios/CardFieldView.swift +1 -0
  15. package/ios/CardFormView.swift +1 -0
  16. package/ios/Mappers.swift +2 -0
  17. package/ios/PaymentMethodFactory.swift +8 -0
  18. package/ios/StripeSdk.swift +5 -1
  19. package/ios/pushprovisioning/AddToWalletButtonManager.m +1 -4
  20. package/ios/pushprovisioning/AddToWalletButtonView.swift +12 -14
  21. package/lib/commonjs/components/AddToWalletButton.js +1 -1
  22. package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
  23. package/lib/commonjs/components/CardField.js +1 -1
  24. package/lib/commonjs/components/CardField.js.map +1 -1
  25. package/lib/commonjs/components/CardForm.js +1 -1
  26. package/lib/commonjs/components/CardForm.js.map +1 -1
  27. package/lib/commonjs/components/StripeProvider.js +1 -1
  28. package/lib/commonjs/components/StripeProvider.js.map +1 -1
  29. package/lib/commonjs/types/SetupIntent.js.map +1 -1
  30. package/lib/commonjs/types/components/CardFieldInput.js.map +1 -1
  31. package/lib/module/components/AddToWalletButton.js +1 -1
  32. package/lib/module/components/AddToWalletButton.js.map +1 -1
  33. package/lib/module/components/CardField.js +1 -1
  34. package/lib/module/components/CardField.js.map +1 -1
  35. package/lib/module/components/CardForm.js +1 -1
  36. package/lib/module/components/CardForm.js.map +1 -1
  37. package/lib/module/components/StripeProvider.js +1 -1
  38. package/lib/module/components/StripeProvider.js.map +1 -1
  39. package/lib/module/types/SetupIntent.js.map +1 -1
  40. package/lib/module/types/components/CardFieldInput.js.map +1 -1
  41. package/lib/typescript/example/src/App.d.ts +1 -0
  42. package/lib/typescript/example/src/screens/PayPalScreen.d.ts +1 -0
  43. package/lib/typescript/src/components/AddToWalletButton.d.ts +18 -11
  44. package/lib/typescript/src/types/PaymentMethod.d.ts +8 -2
  45. package/lib/typescript/src/types/SetupIntent.d.ts +1 -1
  46. package/lib/typescript/src/types/components/CardFieldInput.d.ts +1 -0
  47. package/lib/typescript/src/types/components/CardFormView.d.ts +1 -0
  48. package/package.json +2 -2
  49. package/src/components/AddToWalletButton.tsx +18 -11
  50. package/src/components/CardField.tsx +2 -1
  51. package/src/components/CardForm.tsx +2 -1
  52. package/src/types/PaymentMethod.ts +10 -1
  53. package/src/types/SetupIntent.ts +18 -1
  54. package/src/types/components/CardFieldInput.ts +1 -0
  55. package/src/types/components/CardFormView.ts +1 -0
  56. package/stripe-react-native.podspec +3 -2
@@ -1,2 +1,2 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.CardField=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _helpers=require("../helpers");var _excluded=["onCardChange","onFocus","onBlur","cardStyle","placeholders","postalCodeEnabled"];var _this=this,_jsxFileName="/Users/acomley/stripe/stripe-react-native/src/components/CardField.tsx";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var CardFieldNative=(0,_reactNative.requireNativeComponent)('CardField');var CardField=(0,_react.forwardRef)(function(_ref,ref){var onCardChange=_ref.onCardChange,onFocus=_ref.onFocus,onBlur=_ref.onBlur,cardStyle=_ref.cardStyle,placeholders=_ref.placeholders,postalCodeEnabled=_ref.postalCodeEnabled,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);var inputRef=(0,_react.useRef)(null);var onCardChangeHandler=(0,_react.useCallback)(function(event){var card=event.nativeEvent;var data={last4:card.last4,expiryMonth:card.expiryMonth,expiryYear:card.expiryYear,complete:card.complete,brand:card.brand,validExpiryDate:card.validExpiryDate,validNumber:card.validNumber,validCVC:card.validCVC};if(card.hasOwnProperty('postalCode')){data.postalCode=card.postalCode||'';}if(card.hasOwnProperty('number')){data.number=card.number||'';if(__DEV__&&onCardChange&&card.complete){console.warn("[stripe-react-native] \u26A0\uFE0F WARNING: You've enabled `dangerouslyGetFullCardDetails`, meaning full card details are being returned. Only do this if you're certain that you fulfill the necessary PCI compliance requirements. Make sure that you're not mistakenly logging or storing full card details! See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance");}}onCardChange==null?void 0:onCardChange(data);},[onCardChange]);var onFocusHandler=(0,_react.useCallback)(function(event){var focusedField=event.nativeEvent.focusedField;if(focusedField){(0,_helpers.focusInput)(inputRef.current);onFocus==null?void 0:onFocus(focusedField);}else{onBlur==null?void 0:onBlur();}},[onFocus,onBlur]);var focus=function focus(){_reactNative.UIManager.dispatchViewManagerCommand((0,_reactNative.findNodeHandle)(inputRef.current),'focus',[]);};var blur=function blur(){_reactNative.UIManager.dispatchViewManagerCommand((0,_reactNative.findNodeHandle)(inputRef.current),'blur',[]);};var clear=function clear(){_reactNative.UIManager.dispatchViewManagerCommand((0,_reactNative.findNodeHandle)(inputRef.current),'clear',[]);};(0,_react.useImperativeHandle)(ref,function(){return{focus:focus,blur:blur,clear:clear};});(0,_react.useLayoutEffect)(function(){var inputRefValue=inputRef.current;if(inputRefValue!==null){(0,_helpers.registerInput)(inputRefValue);return function(){(0,_helpers.unregisterInput)(inputRefValue);if((0,_helpers.currentlyFocusedInput)()===inputRefValue){inputRefValue.blur();}};}return function(){};},[inputRef]);return _react.default.createElement(CardFieldNative,(0,_extends2.default)({ref:inputRef,onCardChange:onCardChangeHandler,onFocusChange:onFocusHandler,postalCodeEnabled:postalCodeEnabled!=null?postalCodeEnabled:true,cardStyle:{backgroundColor:cardStyle==null?void 0:cardStyle.backgroundColor,borderColor:cardStyle==null?void 0:cardStyle.borderColor,borderWidth:cardStyle==null?void 0:cardStyle.borderWidth,borderRadius:cardStyle==null?void 0:cardStyle.borderRadius,cursorColor:cardStyle==null?void 0:cardStyle.cursorColor,fontSize:cardStyle==null?void 0:cardStyle.fontSize,placeholderColor:cardStyle==null?void 0:cardStyle.placeholderColor,textColor:cardStyle==null?void 0:cardStyle.textColor,textErrorColor:cardStyle==null?void 0:cardStyle.textErrorColor,fontFamily:cardStyle==null?void 0:cardStyle.fontFamily},placeholders:{number:placeholders==null?void 0:placeholders.number,expiration:placeholders==null?void 0:placeholders.expiration,cvc:placeholders==null?void 0:placeholders.cvc,postalCode:placeholders==null?void 0:placeholders.postalCode}},props,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:172,columnNumber:7}}));});exports.CardField=CardField;
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.CardField=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _helpers=require("../helpers");var _excluded=["onCardChange","onFocus","onBlur","cardStyle","placeholders","postalCodeEnabled"];var _this=this,_jsxFileName="/Users/acomley/stripe/stripe-react-native/src/components/CardField.tsx";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var CardFieldNative=(0,_reactNative.requireNativeComponent)('CardField');var CardField=(0,_react.forwardRef)(function(_ref,ref){var onCardChange=_ref.onCardChange,onFocus=_ref.onFocus,onBlur=_ref.onBlur,cardStyle=_ref.cardStyle,placeholders=_ref.placeholders,postalCodeEnabled=_ref.postalCodeEnabled,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);var inputRef=(0,_react.useRef)(null);var onCardChangeHandler=(0,_react.useCallback)(function(event){var card=event.nativeEvent;var data={last4:card.last4,expiryMonth:card.expiryMonth,expiryYear:card.expiryYear,complete:card.complete,brand:card.brand,validExpiryDate:card.validExpiryDate,validNumber:card.validNumber,validCVC:card.validCVC};if(card.hasOwnProperty('postalCode')){data.postalCode=card.postalCode||'';}if(card.hasOwnProperty('number')||card.hasOwnProperty('cvc')){data.number=card.number||'';data.cvc=card.cvc||'';if(__DEV__&&onCardChange&&card.complete){console.warn("[stripe-react-native] \u26A0\uFE0F WARNING: You've enabled `dangerouslyGetFullCardDetails`, meaning full card details are being returned. Only do this if you're certain that you fulfill the necessary PCI compliance requirements. Make sure that you're not mistakenly logging or storing full card details! See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance");}}onCardChange==null?void 0:onCardChange(data);},[onCardChange]);var onFocusHandler=(0,_react.useCallback)(function(event){var focusedField=event.nativeEvent.focusedField;if(focusedField){(0,_helpers.focusInput)(inputRef.current);onFocus==null?void 0:onFocus(focusedField);}else{onBlur==null?void 0:onBlur();}},[onFocus,onBlur]);var focus=function focus(){_reactNative.UIManager.dispatchViewManagerCommand((0,_reactNative.findNodeHandle)(inputRef.current),'focus',[]);};var blur=function blur(){_reactNative.UIManager.dispatchViewManagerCommand((0,_reactNative.findNodeHandle)(inputRef.current),'blur',[]);};var clear=function clear(){_reactNative.UIManager.dispatchViewManagerCommand((0,_reactNative.findNodeHandle)(inputRef.current),'clear',[]);};(0,_react.useImperativeHandle)(ref,function(){return{focus:focus,blur:blur,clear:clear};});(0,_react.useLayoutEffect)(function(){var inputRefValue=inputRef.current;if(inputRefValue!==null){(0,_helpers.registerInput)(inputRefValue);return function(){(0,_helpers.unregisterInput)(inputRefValue);if((0,_helpers.currentlyFocusedInput)()===inputRefValue){inputRefValue.blur();}};}return function(){};},[inputRef]);return _react.default.createElement(CardFieldNative,(0,_extends2.default)({ref:inputRef,onCardChange:onCardChangeHandler,onFocusChange:onFocusHandler,postalCodeEnabled:postalCodeEnabled!=null?postalCodeEnabled:true,cardStyle:{backgroundColor:cardStyle==null?void 0:cardStyle.backgroundColor,borderColor:cardStyle==null?void 0:cardStyle.borderColor,borderWidth:cardStyle==null?void 0:cardStyle.borderWidth,borderRadius:cardStyle==null?void 0:cardStyle.borderRadius,cursorColor:cardStyle==null?void 0:cardStyle.cursorColor,fontSize:cardStyle==null?void 0:cardStyle.fontSize,placeholderColor:cardStyle==null?void 0:cardStyle.placeholderColor,textColor:cardStyle==null?void 0:cardStyle.textColor,textErrorColor:cardStyle==null?void 0:cardStyle.textErrorColor,fontFamily:cardStyle==null?void 0:cardStyle.fontFamily},placeholders:{number:placeholders==null?void 0:placeholders.number,expiration:placeholders==null?void 0:placeholders.expiration,cvc:placeholders==null?void 0:placeholders.cvc,postalCode:placeholders==null?void 0:placeholders.postalCode}},props,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:173,columnNumber:7}}));});exports.CardField=CardField;
2
2
  //# sourceMappingURL=CardField.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["CardField.tsx"],"names":["CardFieldNative","CardField","ref","onCardChange","onFocus","onBlur","cardStyle","placeholders","postalCodeEnabled","props","inputRef","onCardChangeHandler","event","card","nativeEvent","data","last4","expiryMonth","expiryYear","complete","brand","validExpiryDate","validNumber","validCVC","hasOwnProperty","postalCode","number","__DEV__","console","warn","onFocusHandler","focusedField","current","focus","UIManager","dispatchViewManagerCommand","blur","clear","inputRefValue","backgroundColor","borderColor","borderWidth","borderRadius","cursorColor","fontSize","placeholderColor","textColor","textErrorColor","fontFamily","expiration","cvc"],"mappings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\n useLayoutEffect,\n useRef,\n} from 'react';\nimport {\n AccessibilityProps,\n NativeSyntheticEvent,\n requireNativeComponent,\n UIManager,\n StyleProp,\n findNodeHandle,\n ViewStyle,\n} from 'react-native';\nimport {\n currentlyFocusedInput,\n focusInput,\n registerInput,\n unregisterInput,\n} from '../helpers';\n\nconst CardFieldNative =\n requireNativeComponent<CardFieldInput.NativeProps>('CardField');\n\n/**\n * Card Field Component Props\n */\nexport interface Props extends AccessibilityProps {\n style?: StyleProp<ViewStyle>;\n postalCodeEnabled?: boolean;\n cardStyle?: CardFieldInput.Styles;\n placeholders?: CardFieldInput.Placeholders;\n autofocus?: boolean;\n onCardChange?(card: CardFieldInput.Details): void;\n onBlur?(): void;\n onFocus?(focusedField: CardFieldInput.FieldName | null): void;\n testID?: string;\n /**\n * WARNING: If set to `true` the full card number will be returned in the `onCardChange` handler.\n * Only do this if you're certain that you fulfill the necessary PCI compliance requirements.\n * Make sure that you're not mistakenly logging or storing full card details!\n * See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance\n */\n dangerouslyGetFullCardDetails?: boolean;\n}\n\n/**\n * Card Field Component\n *\n * @example\n * ```ts\n * <CardField\n * postalCodeEnabled={false}\n * onCardChange={(cardDetails) => {\n * console.log('card details', cardDetails);\n * setCard(cardDetails);\n * }}\n * style={{height: 50}}\n * />\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport const CardField = forwardRef<CardFieldInput.Methods, Props>(\n (\n {\n onCardChange,\n onFocus,\n onBlur,\n cardStyle,\n placeholders,\n postalCodeEnabled,\n ...props\n },\n ref\n ) => {\n const inputRef = useRef<any>(null);\n\n const onCardChangeHandler = useCallback(\n (event: NativeSyntheticEvent<CardFieldInput.Details>) => {\n const card = event.nativeEvent;\n\n const data: CardFieldInput.Details = {\n last4: card.last4,\n expiryMonth: card.expiryMonth,\n expiryYear: card.expiryYear,\n complete: card.complete,\n brand: card.brand,\n validExpiryDate: card.validExpiryDate,\n validNumber: card.validNumber,\n validCVC: card.validCVC,\n };\n\n if (card.hasOwnProperty('postalCode')) {\n data.postalCode = card.postalCode || '';\n }\n if (card.hasOwnProperty('number')) {\n data.number = card.number || '';\n if (__DEV__ && onCardChange && card.complete) {\n console.warn(\n `[stripe-react-native] ⚠️ WARNING: You've enabled \\`dangerouslyGetFullCardDetails\\`, meaning full card details are being returned. Only do this if you're certain that you fulfill the necessary PCI compliance requirements. Make sure that you're not mistakenly logging or storing full card details! See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance`\n );\n }\n }\n onCardChange?.(data);\n },\n [onCardChange]\n );\n\n const onFocusHandler = useCallback(\n (event) => {\n const { focusedField } = event.nativeEvent;\n if (focusedField) {\n focusInput(inputRef.current);\n onFocus?.(focusedField);\n } else {\n onBlur?.();\n }\n },\n [onFocus, onBlur]\n );\n\n const focus = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(inputRef.current),\n 'focus' as any,\n []\n );\n };\n\n const blur = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(inputRef.current),\n 'blur' as any,\n []\n );\n };\n\n const clear = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(inputRef.current),\n 'clear' as any,\n []\n );\n };\n\n useImperativeHandle(ref, () => ({\n focus,\n blur,\n clear,\n }));\n\n useLayoutEffect(() => {\n const inputRefValue = inputRef.current;\n if (inputRefValue !== null) {\n registerInput(inputRefValue);\n return () => {\n unregisterInput(inputRefValue);\n if (currentlyFocusedInput() === inputRefValue) {\n inputRefValue.blur();\n }\n };\n }\n return () => {};\n }, [inputRef]);\n\n return (\n <CardFieldNative\n ref={inputRef}\n onCardChange={onCardChangeHandler}\n onFocusChange={onFocusHandler}\n postalCodeEnabled={postalCodeEnabled ?? true}\n cardStyle={{\n backgroundColor: cardStyle?.backgroundColor,\n borderColor: cardStyle?.borderColor,\n borderWidth: cardStyle?.borderWidth,\n borderRadius: cardStyle?.borderRadius,\n cursorColor: cardStyle?.cursorColor,\n fontSize: cardStyle?.fontSize,\n placeholderColor: cardStyle?.placeholderColor,\n textColor: cardStyle?.textColor,\n textErrorColor: cardStyle?.textErrorColor,\n fontFamily: cardStyle?.fontFamily,\n }}\n placeholders={{\n number: placeholders?.number,\n expiration: placeholders?.expiration,\n cvc: placeholders?.cvc,\n postalCode: placeholders?.postalCode,\n }}\n {...props}\n />\n );\n }\n);\n"]}
1
+ {"version":3,"sources":["CardField.tsx"],"names":["CardFieldNative","CardField","ref","onCardChange","onFocus","onBlur","cardStyle","placeholders","postalCodeEnabled","props","inputRef","onCardChangeHandler","event","card","nativeEvent","data","last4","expiryMonth","expiryYear","complete","brand","validExpiryDate","validNumber","validCVC","hasOwnProperty","postalCode","number","cvc","__DEV__","console","warn","onFocusHandler","focusedField","current","focus","UIManager","dispatchViewManagerCommand","blur","clear","inputRefValue","backgroundColor","borderColor","borderWidth","borderRadius","cursorColor","fontSize","placeholderColor","textColor","textErrorColor","fontFamily","expiration"],"mappings":"qWACA,qDAOA,yCASA,mC,gsCAOA,GAAMA,CAAAA,eAAe,CACnB,wCAAmD,WAAnD,CADF,CA2CO,GAAMC,CAAAA,SAAS,CAAG,sBACvB,cAUEC,GAVF,CAWK,IATDC,CAAAA,YASC,MATDA,YASC,CARDC,OAQC,MARDA,OAQC,CAPDC,MAOC,MAPDA,MAOC,CANDC,SAMC,MANDA,SAMC,CALDC,YAKC,MALDA,YAKC,CAJDC,iBAIC,MAJDA,iBAIC,CAHEC,KAGF,uDACH,GAAMC,CAAAA,QAAQ,CAAG,kBAAY,IAAZ,CAAjB,CAEA,GAAMC,CAAAA,mBAAmB,CAAG,uBAC1B,SAACC,KAAD,CAAyD,CACvD,GAAMC,CAAAA,IAAI,CAAGD,KAAK,CAACE,WAAnB,CAEA,GAAMC,CAAAA,IAA4B,CAAG,CACnCC,KAAK,CAAEH,IAAI,CAACG,KADuB,CAEnCC,WAAW,CAAEJ,IAAI,CAACI,WAFiB,CAGnCC,UAAU,CAAEL,IAAI,CAACK,UA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B,CAKTC,WAAW,CAAEtC,SAAF,cAAEA,SAAS,CAAEsC,WALf,CAMTC,QAAQ,CAAEvC,SAAF,cAAEA,SAAS,CAAEuC,QANZ,CAOTC,gBAAgB,CAAExC,SAAF,cAAEA,SAAS,CAAEwC,gBAPpB,CAQTC,SAAS,CAAEzC,SAAF,cAAEA,SAAS,CAAEyC,SARb,CASTC,cAAc,CAAE1C,SAAF,cAAEA,SAAS,CAAE0C,cATlB,CAUTC,UAAU,CAAE3C,SAAF,cAAEA,SAAS,CAAE2C,UAVd,CALb,CAiBE,YAAY,CAAE,CACZvB,MAAM,CAAEnB,YAAF,cAAEA,YAAY,CAAEmB,MADV,CAEZwB,UAAU,CAAE3C,YAAF,cAAEA,YAAY,CAAE2C,UAFd,CAGZvB,GAAG,CAAEpB,YAAF,cAAEA,YAAY,CAAEoB,GAHP,CAIZF,UAAU,CAAElB,YAAF,cAAEA,YAAY,CAAEkB,UAJd,CAjBhB,EAuBMhB,KAvBN,gFADF,CA2BD,CAnIsB,CAAlB,C","sourcesContent":["import type { CardFieldInput } from '../types';\nimport React, {\n forwardRef,\n useCallback,\n useImperativeHandle,\n useLayoutEffect,\n useRef,\n} from 'react';\nimport {\n AccessibilityProps,\n NativeSyntheticEvent,\n requireNativeComponent,\n UIManager,\n StyleProp,\n findNodeHandle,\n ViewStyle,\n} from 'react-native';\nimport {\n currentlyFocusedInput,\n focusInput,\n registerInput,\n unregisterInput,\n} from '../helpers';\n\nconst CardFieldNative =\n requireNativeComponent<CardFieldInput.NativeProps>('CardField');\n\n/**\n * Card Field Component Props\n */\nexport interface Props extends AccessibilityProps {\n style?: StyleProp<ViewStyle>;\n postalCodeEnabled?: boolean;\n cardStyle?: CardFieldInput.Styles;\n placeholders?: CardFieldInput.Placeholders;\n autofocus?: boolean;\n onCardChange?(card: CardFieldInput.Details): void;\n onBlur?(): void;\n onFocus?(focusedField: CardFieldInput.FieldName | null): void;\n testID?: string;\n /**\n * WARNING: If set to `true` the full card number will be returned in the `onCardChange` handler.\n * Only do this if you're certain that you fulfill the necessary PCI compliance requirements.\n * Make sure that you're not mistakenly logging or storing full card details!\n * See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance\n */\n dangerouslyGetFullCardDetails?: boolean;\n}\n\n/**\n * Card Field Component\n *\n * @example\n * ```ts\n * <CardField\n * postalCodeEnabled={false}\n * onCardChange={(cardDetails) => {\n * console.log('card details', cardDetails);\n * setCard(cardDetails);\n * }}\n * style={{height: 50}}\n * />\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport const CardField = forwardRef<CardFieldInput.Methods, Props>(\n (\n {\n onCardChange,\n onFocus,\n onBlur,\n cardStyle,\n placeholders,\n postalCodeEnabled,\n ...props\n },\n ref\n ) => {\n const inputRef = useRef<any>(null);\n\n const onCardChangeHandler = useCallback(\n (event: NativeSyntheticEvent<CardFieldInput.Details>) => {\n const card = event.nativeEvent;\n\n const data: CardFieldInput.Details = {\n last4: card.last4,\n expiryMonth: card.expiryMonth,\n expiryYear: card.expiryYear,\n complete: card.complete,\n brand: card.brand,\n validExpiryDate: card.validExpiryDate,\n validNumber: card.validNumber,\n validCVC: card.validCVC,\n };\n\n if (card.hasOwnProperty('postalCode')) {\n data.postalCode = card.postalCode || '';\n }\n if (card.hasOwnProperty('number') || card.hasOwnProperty('cvc')) {\n data.number = card.number || '';\n data.cvc = card.cvc || '';\n if (__DEV__ && onCardChange && card.complete) {\n console.warn(\n `[stripe-react-native] ⚠️ WARNING: You've enabled \\`dangerouslyGetFullCardDetails\\`, meaning full card details are being returned. Only do this if you're certain that you fulfill the necessary PCI compliance requirements. Make sure that you're not mistakenly logging or storing full card details! See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance`\n );\n }\n }\n onCardChange?.(data);\n },\n [onCardChange]\n );\n\n const onFocusHandler = useCallback(\n (event) => {\n const { focusedField } = event.nativeEvent;\n if (focusedField) {\n focusInput(inputRef.current);\n onFocus?.(focusedField);\n } else {\n onBlur?.();\n }\n },\n [onFocus, onBlur]\n );\n\n const focus = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(inputRef.current),\n 'focus' as any,\n []\n );\n };\n\n const blur = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(inputRef.current),\n 'blur' as any,\n []\n );\n };\n\n const clear = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(inputRef.current),\n 'clear' as any,\n []\n );\n };\n\n useImperativeHandle(ref, () => ({\n focus,\n blur,\n clear,\n }));\n\n useLayoutEffect(() => {\n const inputRefValue = inputRef.current;\n if (inputRefValue !== null) {\n registerInput(inputRefValue);\n return () => {\n unregisterInput(inputRefValue);\n if (currentlyFocusedInput() === inputRefValue) {\n inputRefValue.blur();\n }\n };\n }\n return () => {};\n }, [inputRef]);\n\n return (\n <CardFieldNative\n ref={inputRef}\n onCardChange={onCardChangeHandler}\n onFocusChange={onFocusHandler}\n postalCodeEnabled={postalCodeEnabled ?? true}\n cardStyle={{\n backgroundColor: cardStyle?.backgroundColor,\n borderColor: cardStyle?.borderColor,\n borderWidth: cardStyle?.borderWidth,\n borderRadius: cardStyle?.borderRadius,\n cursorColor: cardStyle?.cursorColor,\n fontSize: cardStyle?.fontSize,\n placeholderColor: cardStyle?.placeholderColor,\n textColor: cardStyle?.textColor,\n textErrorColor: cardStyle?.textErrorColor,\n fontFamily: cardStyle?.fontFamily,\n }}\n placeholders={{\n number: placeholders?.number,\n expiration: placeholders?.expiration,\n cvc: placeholders?.cvc,\n postalCode: placeholders?.postalCode,\n }}\n {...props}\n />\n );\n }\n);\n"]}
@@ -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"];var _this=this,_jsxFileName="/Users/acomley/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,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')){data.number=card.number||'';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},onFocusChange:onFocusHandler},props,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:163,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"];var _this=this,_jsxFileName="/Users/acomley/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,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},onFocusChange:onFocusHandler},props,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:164,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","props","inputRef","onFormCompleteHandler","event","card","nativeEvent","data","last4","expiryMonth","expiryYear","complete","brand","country","postalCode","hasOwnProperty","number","__DEV__","console","warn","focus","UIManager","dispatchViewManagerCommand","current","blur","onFocusHandler","focusedField","inputRefValue","backgroundColor","borderColor","borderWidth","borderRadius","cursorColor","fontSize","placeholderColor","textColor","textErrorColor","fontFamily","expiration","cvc"],"mappings":"oWACA,qDAOA,yCASA,mC,0pCAOA,GAAMA,CAAAA,cAAc,CAClB,wCAAiD,UAAjD,CADF,CAiDO,GAAMC,CAAAA,QAAQ,CAAG,sBACtB,cAWEC,GAXF,CAYK,IAVDC,CAAAA,cAUC,MAVDA,cAUC,CATDC,SASC,MATDA,SASC,CAJDC,YAIC,MAJDA,YAIC,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,UA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AAhC,CAA+C,CAC7CA,aAAa,CAACH,IAAd,GACD,CACF,CALD,CAMD,CACD,MAAO,WAAM,CAAE,CAAf,CACD,CAZD,CAYG,CAACtB,QAAD,CAZH,EAcA,MACE,8BAAC,cAAD,wBACE,GAAG,CAAEA,QADP,CAEE,cAAc,CAAEC,qBAFlB,CAGE,SAAS,CAAE,CACTyB,eAAe,CAAE7B,SAAF,cAAEA,SAAS,CAAE6B,eADnB,CAETC,WAAW,CAAE9B,SAAF,cAAEA,SAAS,CAAE8B,WAFf,CAGTC,WAAW,CAAE/B,SAAF,cAAEA,SAAS,CAAE+B,WAHf,CAITC,YAAY,CAAEhC,SAAF,cAAEA,SAAS,CAAEgC,YAJhB,CAKTC,WAAW,CAAEjC,SAAF,cAAEA,SAAS,CAAEiC,WALf,CAMTC,QAAQ,CAAElC,SAAF,cAAEA,SAAS,CAAEkC,QANZ,CAOTC,gBAAgB,CAAEnC,SAAF,cAAEA,SAAS,CAAEmC,gBAPpB,CAQTC,SAAS,CAAEpC,SAAF,cAAEA,SAAS,CAAEoC,SARb,CASTC,cAAc,CAAErC,SAAF,cAAEA,SAAS,CAAEqC,cATlB,CAUTC,UAAU,CAAEtC,SAAF,cAAEA,SAAS,CAAEsC,UAVd,CAHb,CAkBE,YAAY,CAAE,CACZrB,MAAM,CAAEhB,YAAF,cAAEA,YAAY,CAAEgB,MADV,CAEZsB,UAAU,CAAEtC,YAAF,cAAEA,YAAY,CAAEsC,UAFd,CAGZC,GAAG,CAAEvC,YAAF,cAAEA,YAAY,CAAEuC,GAHP,CAIZzB,UAAU,CAAEd,YAAF,cAAEA,YAAY,CAAEc,UAJd,CAlBhB,CAwBE,aAAa,CAAEW,cAxBjB,EA0BMxB,KA1BN,gFADF,CA8BD,CAtHqB,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 are Android only */\n cardStyle?: CardFormView.Styles;\n // isUserInteractionEnabled?: boolean;\n\n // TODO: will make it public when android-sdk allows for this\n // postalCodeEnabled?: boolean;\n\n /** Android only */\n placeholders?: CardFormView.Placeholders;\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 ...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')) {\n data.number = card.number || '';\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 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","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,0pCAOA,GAAMA,CAAAA,cAAc,CAClB,wCAAiD,UAAjD,CADF,CAiDO,GAAMC,CAAAA,QAAQ,CAAG,sBACtB,cAWEC,GAXF,CAYK,IAVDC,CAAAA,cAUC,MAVDA,cAUC,CATDC,SASC,MATDA,SASC,CAJDC,YAIC,MAJDA,YAIC,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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A,MAAO,WAAM,CACX,6BAAgBA,aAAhB,EACA,GAAI,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,CAAE9B,SAAF,cAAEA,SAAS,CAAE8B,eADnB,CAETC,WAAW,CAAE/B,SAAF,cAAEA,SAAS,CAAE+B,WAFf,CAGTC,WAAW,CAAEhC,SAAF,cAAEA,SAAS,CAAEgC,WAHf,CAITC,YAAY,CAAEjC,SAAF,cAAEA,SAAS,CAAEiC,YAJhB,CAKTC,WAAW,CAAElC,SAAF,cAAEA,SAAS,CAAEkC,WALf,CAMTC,QAAQ,CAAEnC,SAAF,cAAEA,SAAS,CAAEmC,QANZ,CAOTC,gBAAgB,CAAEpC,SAAF,cAAEA,SAAS,CAAEoC,gBAPpB,CAQTC,SAAS,CAAErC,SAAF,cAAEA,SAAS,CAAEqC,SARb,CASTC,cAAc,CAAEtC,SAAF,cAAEA,SAAS,CAAEsC,cATlB,CAUTC,UAAU,CAAEvC,SAAF,cAAEA,SAAS,CAAEuC,UAVd,CAHb,CAkBE,YAAY,CAAE,CACZtB,MAAM,CAAEhB,YAAF,cAAEA,YAAY,CAAEgB,MADV,CAEZuB,UAAU,CAAEvC,YAAF,cAAEA,YAAY,CAAEuC,UAFd,CAGZtB,GAAG,CAAEjB,YAAF,cAAEA,YAAY,CAAEiB,GAHP,CAIZH,UAAU,CAAEd,YAAF,cAAEA,YAAY,CAAEc,UAJd,CAlBhB,CAwBE,aAAa,CAAEY,cAxBjB,EA0BMzB,KA1BN,gFADF,CA8BD,CAvHqB,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 are Android only */\n cardStyle?: CardFormView.Styles;\n // isUserInteractionEnabled?: boolean;\n\n // TODO: will make it public when android-sdk allows for this\n // postalCodeEnabled?: boolean;\n\n /** Android only */\n placeholders?: CardFormView.Placeholders;\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 ...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 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 _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);}
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,mE,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"],"mappings":"2WAAA,qDAEA,2EACA,mCAEA,sE,0/BAEA,GAAMA,CAAA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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 +1 @@
1
- {"version":3,"sources":["SetupIntent.ts"],"names":["Status"],"mappings":"kFA6BYA,CAAAA,M,iCAAAA,M,EAAAA,M,0BAAAA,M,kDAAAA,M,gDAAAA,M,wBAAAA,M,4BAAAA,M,oCAAAA,M,yBAAAA,M,kBAAAA,M","sourcesContent":["import type { Type } from './PaymentMethod';\nimport type { LastPaymentError } from './PaymentIntent';\nimport type { NextAction } from './NextAction';\nimport type * as PaymentMethod from './PaymentMethod';\nexport interface Result {\n id: string;\n clientSecret: string;\n lastSetupError: LastPaymentError | null;\n created: string | null;\n livemode: boolean;\n paymentMethodId: string | null;\n status: Status;\n paymentMethodTypes: Type[];\n usage: FutureUsage;\n description: string | null;\n nextAction: NextAction | null;\n}\n\nexport type ConfirmParams = PaymentMethod.CreateParams;\n\nexport type ConfirmOptions = {};\n\nexport type FutureUsage =\n | 'Unknown'\n | 'None'\n | 'OnSession'\n | 'OffSession'\n | 'OneTime';\n\nexport enum Status {\n Succeeded = 'Succeeded',\n RequiresPaymentMethod = 'RequiresPaymentMethod',\n RequiresConfirmation = 'RequiresConfirmation',\n Canceled = 'Canceled',\n Processing = 'Processing',\n RequiresAction = 'RequiresAction',\n Unknown = 'Unknown',\n}\n"]}
1
+ {"version":3,"sources":["SetupIntent.ts"],"names":["Status"],"mappings":"kFA8CYA,CAAAA,M,iCAAAA,M,EAAAA,M,0BAAAA,M,kDAAAA,M,gDAAAA,M,wBAAAA,M,4BAAAA,M,oCAAAA,M,yBAAAA,M,kBAAAA,M","sourcesContent":["import type { Type } from './PaymentMethod';\nimport type { LastPaymentError } from './PaymentIntent';\nimport type { NextAction } from './NextAction';\nimport type * as PaymentMethod from './PaymentMethod';\nexport interface Result {\n id: string;\n clientSecret: string;\n lastSetupError: LastPaymentError | null;\n created: string | null;\n livemode: boolean;\n paymentMethodId: string | null;\n status: Status;\n paymentMethodTypes: Type[];\n usage: FutureUsage;\n description: string | null;\n nextAction: NextAction | null;\n}\n\nexport type ConfirmParams =\n | PaymentMethod.CardParams\n | PaymentMethod.IdealParams\n | PaymentMethod.OxxoParams\n | PaymentMethod.P24Params\n | PaymentMethod.AlipayParams\n | PaymentMethod.GiropayParams\n | PaymentMethod.SepaParams\n | PaymentMethod.EpsParams\n | PaymentMethod.AuBecsDebitParams\n | PaymentMethod.SofortParams\n | PaymentMethod.GrabPayParams\n | PaymentMethod.FPXParams\n | PaymentMethod.AfterpayClearpayParams\n | PaymentMethod.KlarnaParams\n | PaymentMethod.BancontactParams\n | PaymentMethod.USBankAccountParams;\n// TODO: Change the above back to PaymentMethod.CreateParams when PayPal is supported through SetupIntents\n\nexport type ConfirmOptions = {};\n\nexport type FutureUsage =\n | 'Unknown'\n | 'None'\n | 'OnSession'\n | 'OffSession'\n | 'OneTime';\n\nexport enum Status {\n Succeeded = 'Succeeded',\n RequiresPaymentMethod = 'RequiresPaymentMethod',\n RequiresConfirmation = 'RequiresConfirmation',\n Canceled = 'Canceled',\n Processing = 'Processing',\n RequiresAction = 'RequiresAction',\n Unknown = 'Unknown',\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["CardFieldInput.ts"],"names":["ValidationState"],"mappings":"2FAKYA,CAAAA,e,mDAAAA,e,EAAAA,e,kBAAAA,e,sBAAAA,e,4BAAAA,e,yBAAAA,e,2BAAAA,e","sourcesContent":["import type { NativeSyntheticEvent, StyleProp, ViewStyle } from 'react-native';\nimport type { CardBrand } from '../Token';\n\nexport type FieldName = 'CardNumber' | 'Cvc' | 'ExpiryDate' | 'PostalCode';\n\nexport enum ValidationState {\n Valid = 'Valid',\n Invalid = 'Invalid',\n Incomplete = 'Incomplete',\n Unknown = 'Unknown',\n}\n\nexport interface Details {\n last4: string;\n expiryMonth: number;\n expiryYear: number;\n postalCode?: string;\n brand: CardBrand;\n complete: boolean;\n validExpiryDate: ValidationState;\n validCVC: ValidationState;\n validNumber: ValidationState;\n /**\n * WARNING: Full card details are only returned when the `dangerouslyGetFullCardDetails` prop\n * on the `CardField` component is set to `true`.\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 number?: string;\n}\n\nexport interface Styles {\n borderWidth?: number;\n backgroundColor?: string;\n borderColor?: string;\n borderRadius?: number;\n textColor?: string;\n fontSize?: number;\n placeholderColor?: string;\n cursorColor?: string;\n textErrorColor?: string;\n fontFamily?: string;\n}\n\nexport interface Placeholders {\n number?: string;\n expiration?: string;\n cvc?: string;\n postalCode?: string;\n}\n\n/**\n * @ignore\n */\nexport interface NativeProps {\n style?: StyleProp<ViewStyle>;\n value?: Partial<Details>;\n postalCodeEnabled?: boolean;\n autofocus?: boolean;\n onCardChange(event: NativeSyntheticEvent<Details>): void;\n onFocusChange(\n event: NativeSyntheticEvent<{ focusedField: FieldName | null }>\n ): void;\n cardStyle?: Styles;\n placeholders?: Placeholders;\n}\n\nexport interface Methods {\n focus(): void;\n blur(): void;\n clear(): void;\n}\n"]}
1
+ {"version":3,"sources":["CardFieldInput.ts"],"names":["ValidationState"],"mappings":"2FAKYA,CAAAA,e,mDAAAA,e,EAAAA,e,kBAAAA,e,sBAAAA,e,4BAAAA,e,yBAAAA,e,2BAAAA,e","sourcesContent":["import type { NativeSyntheticEvent, StyleProp, ViewStyle } from 'react-native';\nimport type { CardBrand } from '../Token';\n\nexport type FieldName = 'CardNumber' | 'Cvc' | 'ExpiryDate' | 'PostalCode';\n\nexport enum ValidationState {\n Valid = 'Valid',\n Invalid = 'Invalid',\n Incomplete = 'Incomplete',\n Unknown = 'Unknown',\n}\n\nexport interface Details {\n last4: string;\n expiryMonth: number;\n expiryYear: number;\n postalCode?: string;\n brand: CardBrand;\n complete: boolean;\n validExpiryDate: ValidationState;\n validCVC: ValidationState;\n validNumber: ValidationState;\n /**\n * WARNING: Full card details are only returned when the `dangerouslyGetFullCardDetails` prop\n * on the `CardField` component is set to `true`.\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 number?: string;\n cvc?: string;\n}\n\nexport interface Styles {\n borderWidth?: number;\n backgroundColor?: string;\n borderColor?: string;\n borderRadius?: number;\n textColor?: string;\n fontSize?: number;\n placeholderColor?: string;\n cursorColor?: string;\n textErrorColor?: string;\n fontFamily?: string;\n}\n\nexport interface Placeholders {\n number?: string;\n expiration?: string;\n cvc?: string;\n postalCode?: string;\n}\n\n/**\n * @ignore\n */\nexport interface NativeProps {\n style?: StyleProp<ViewStyle>;\n value?: Partial<Details>;\n postalCodeEnabled?: boolean;\n autofocus?: boolean;\n onCardChange(event: NativeSyntheticEvent<Details>): void;\n onFocusChange(\n event: NativeSyntheticEvent<{ focusedField: FieldName | null }>\n ): void;\n cardStyle?: Styles;\n placeholders?: Placeholders;\n}\n\nexport interface Methods {\n focus(): void;\n blur(): void;\n clear(): void;\n}\n"]}
@@ -1,2 +1,2 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.AddToWalletButton=AddToWalletButton;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/acomley/stripe/stripe-react-native/src/components/AddToWalletButton.tsx";var _excluded=["onComplete"];var AddToWalletButtonNative=(0,_reactNative.requireNativeComponent)('AddToWalletButton');function AddToWalletButton(_ref){var onComplete=_ref.onComplete,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);return _react.default.createElement(AddToWalletButtonNative,(0,_extends2.default)({},props,{onCompleteAction:function onCompleteAction(value){return onComplete(value.nativeEvent);},__self:this,__source:{fileName:_jsxFileName,lineNumber:77,columnNumber:5}}));}
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.AddToWalletButton=AddToWalletButton;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/acomley/stripe/stripe-react-native/src/components/AddToWalletButton.tsx";var _excluded=["onComplete"];var AddToWalletButtonNative=(0,_reactNative.requireNativeComponent)('AddToWalletButton');function AddToWalletButton(_ref){var onComplete=_ref.onComplete,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);return _react.default.createElement(AddToWalletButtonNative,(0,_extends2.default)({},props,{onCompleteAction:function onCompleteAction(value){return onComplete(value.nativeEvent);},__self:this,__source:{fileName:_jsxFileName,lineNumber:84,columnNumber:5}}));}
2
2
  //# sourceMappingURL=AddToWalletButton.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["AddToWalletButton.tsx"],"names":["AddToWalletButtonNative","AddToWalletButton","onComplete","props","value","nativeEvent"],"mappings":"wXAAA,oDACA,yC,+HAeA,GAAMA,CAAAA,uBAAuB,CAC3B,wCAA4B,mBAA5B,CADF,CA0DO,QAASC,CAAAA,iBAAT,MAA4D,IAA/BC,CAAAA,UAA+B,MAA/BA,UAA+B,CAAhBC,KAAgB,uDACjE,MACE,8BAAC,uBAAD,0BACMA,KADN,EAEE,gBAAgB,CAAE,0BAChBC,KADgB,QAIbF,CAAAA,UAAU,CAACE,KAAK,CAACC,WAAP,CAJG,EAFpB,6EADF,CAUD","sourcesContent":["import React from 'react';\nimport {\n AccessibilityProps,\n StyleProp,\n ViewStyle,\n requireNativeComponent,\n NativeSyntheticEvent,\n ImageSourcePropType,\n} from 'react-native';\nimport type {\n Token,\n CardActionError,\n StripeError,\n GooglePayCardToken,\n} from '../types';\n\nconst AddToWalletButtonNative =\n requireNativeComponent<any>('AddToWalletButton');\n\n/**\n * Add to wallet button component props\n */\nexport interface Props extends AccessibilityProps {\n style?: StyleProp<ViewStyle>;\n /** Sets the Apple Wallet/Google Pay button style. If the button is placed over a dark background, set this to 'onDarkBackground', otherwise set to 'onLightBackground'. */\n iOSButtonStyle?: 'onDarkBackground' | 'onLightBackground';\n /** The image asset to use as the Google Pay button. Downloadable from https://developers.google.com/pay/issuers/apis/push-provisioning/android/downloads/flutter/googlepay_flutter_buttons.zip */\n androidAssetSource: ImageSourcePropType;\n testID?: string;\n /** Only set to `false` when shipping through TestFlight || App Store */\n testEnv?: boolean;\n /** Sets the card holder name (used only on iOS) */\n cardHolderName: string;\n /** Last 4 digits of the card. Required on Android. */\n cardLastFour: string;\n /** Sets the card holder name (used only on iOS) */\n cardDescription?: string;\n /** Optional, only used on iOS */\n cardBrand?: Token.CardBrand;\n // Optional, only for Android and only for cards that are in the \"yellow path\" (as defined by Google- https://developers.google.com/pay/issuers/apis/push-provisioning/android/wallet-operations#resolving_yellow_path). Obtain this value via the `isCardInWallet` method.\n token?: GooglePayCardToken | null;\n /** Used by stripe to securely obtain card info of the card being provisioned. */\n ephemeralKey: object;\n /** Called when the flow completes. If the `error` field is `null`, then the card was successfully added to the user's native wallet. */\n onComplete(result: { error: StripeError<CardActionError> | null }): void;\n}\n\n/**\n * Add to wallet button\n *\n * @example\n * ```ts\n * <AddToWalletButton\n * testEnv={true}\n * style={styles.myButtonStyle}\n * iOSButtonStyle=\"onLightBackground\"\n * cardHolderName=\"David Wallace\"\n * cardLastFour=\"4242\"\n * cardBrand=\"Visa\"\n * ephemeralKey={myEphemeralKey} // This object is retrieved from your server. See https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native#update-your-backend\n * onComplete={(error) => {\n * Alert.alert(\n * error ? error.code : 'Success',\n * error\n * ? error.message\n * : 'Card was successfully added to the wallet.'\n * );\n * }}\n * />\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport function AddToWalletButton({ onComplete, ...props }: Props) {\n return (\n <AddToWalletButtonNative\n {...props}\n onCompleteAction={(\n value: NativeSyntheticEvent<{\n error: StripeError<CardActionError> | null;\n }>\n ) => onComplete(value.nativeEvent)}\n />\n );\n}\n"]}
1
+ {"version":3,"sources":["AddToWalletButton.tsx"],"names":["AddToWalletButtonNative","AddToWalletButton","onComplete","props","value","nativeEvent"],"mappings":"wXAAA,oDACA,yC,+HAeA,GAAMA,CAAAA,uBAAuB,CAC3B,wCAA4B,mBAA5B,CADF,CAiEO,QAASC,CAAAA,iBAAT,MAA4D,IAA/BC,CAAAA,UAA+B,MAA/BA,UAA+B,CAAhBC,KAAgB,uDACjE,MACE,8BAAC,uBAAD,0BACMA,KADN,EAEE,gBAAgB,CAAE,0BAChBC,KADgB,QAIbF,CAAAA,UAAU,CAACE,KAAK,CAACC,WAAP,CAJG,EAFpB,6EADF,CAUD","sourcesContent":["import React from 'react';\nimport {\n AccessibilityProps,\n StyleProp,\n ViewStyle,\n requireNativeComponent,\n NativeSyntheticEvent,\n ImageSourcePropType,\n} from 'react-native';\nimport type {\n Token,\n CardActionError,\n StripeError,\n GooglePayCardToken,\n} from '../types';\n\nconst AddToWalletButtonNative =\n requireNativeComponent<any>('AddToWalletButton');\n\n/**\n * Add to wallet button component props\n */\nexport interface Props extends AccessibilityProps {\n style?: StyleProp<ViewStyle>;\n /** Sets the Apple Wallet/Google Pay button style. If the button is placed over a dark background, set this to 'onDarkBackground', otherwise set to 'onLightBackground'. */\n iOSButtonStyle?: 'onDarkBackground' | 'onLightBackground';\n /** The image asset to use as the Google Pay button. Downloadable from https://developers.google.com/pay/issuers/apis/push-provisioning/android/downloads/flutter/googlepay_flutter_buttons.zip */\n androidAssetSource: ImageSourcePropType;\n testID?: string;\n /** Only set to `false` when shipping through TestFlight || App Store */\n testEnv?: boolean;\n /** Details of the Issued Card you'd like added to the device's wallet */\n cardDetails: {\n /** The `primary_account_identifier` value from the issued card. */\n primaryAccountIdentifier: string | null;\n /** The card holder name (used only on iOS) */\n name: string;\n /** A user-facing description of the card. Required on Android.*/\n description: string;\n /** Last 4 digits of the card, only used on iOS */\n lastFour?: string;\n /** Optional, only used on iOS */\n brand?: Token.CardBrand;\n };\n // Optional, only for Android and only for cards that are in the \"yellow path\" (as defined by Google- https://developers.google.com/pay/issuers/apis/push-provisioning/android/wallet-operations#resolving_yellow_path). Obtain this value via the `isCardInWallet` method.\n token?: GooglePayCardToken | null;\n /** Used by stripe to securely obtain card info of the card being provisioned. */\n ephemeralKey: object;\n /** Called when the flow completes. If the `error` field is `null`, then the card was successfully added to the user's native wallet. */\n onComplete(result: { error: StripeError<CardActionError> | null }): void;\n}\n\n/**\n * Add to wallet button\n *\n * @example\n * ```ts\n * <AddToWalletButton\n * testEnv={true}\n * style={styles.myButtonStyle}\n * iOSButtonStyle=\"onLightBackground\"\n * cardDetails={{\n * primaryAccountIdentifier: \"V-123\",\n * name: \"David Wallace\",\n * lastFour: \"4242\",\n * }}\n * ephemeralKey={myEphemeralKey} // This object is retrieved from your server. See https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native#update-your-backend\n * onComplete={(error) => {\n * Alert.alert(\n * error ? error.code : 'Success',\n * error\n * ? error.message\n * : 'Card was successfully added to the wallet.'\n * );\n * }}\n * />\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport function AddToWalletButton({ onComplete, ...props }: Props) {\n return (\n <AddToWalletButtonNative\n {...props}\n onCompleteAction={(\n value: NativeSyntheticEvent<{\n error: StripeError<CardActionError> | null;\n }>\n ) => onComplete(value.nativeEvent)}\n />\n );\n}\n"]}
@@ -1,2 +1,2 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.CardField=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _helpers=require("../helpers");var _excluded=["onCardChange","onFocus","onBlur","cardStyle","placeholders","postalCodeEnabled"];var _this=this,_jsxFileName="/Users/acomley/stripe/stripe-react-native/src/components/CardField.tsx";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var CardFieldNative=(0,_reactNative.requireNativeComponent)('CardField');var CardField=(0,_react.forwardRef)(function(_ref,ref){var onCardChange=_ref.onCardChange,onFocus=_ref.onFocus,onBlur=_ref.onBlur,cardStyle=_ref.cardStyle,placeholders=_ref.placeholders,postalCodeEnabled=_ref.postalCodeEnabled,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);var inputRef=(0,_react.useRef)(null);var onCardChangeHandler=(0,_react.useCallback)(function(event){var card=event.nativeEvent;var data={last4:card.last4,expiryMonth:card.expiryMonth,expiryYear:card.expiryYear,complete:card.complete,brand:card.brand,validExpiryDate:card.validExpiryDate,validNumber:card.validNumber,validCVC:card.validCVC};if(card.hasOwnProperty('postalCode')){data.postalCode=card.postalCode||'';}if(card.hasOwnProperty('number')){data.number=card.number||'';if(__DEV__&&onCardChange&&card.complete){console.warn("[stripe-react-native] \u26A0\uFE0F WARNING: You've enabled `dangerouslyGetFullCardDetails`, meaning full card details are being returned. Only do this if you're certain that you fulfill the necessary PCI compliance requirements. Make sure that you're not mistakenly logging or storing full card details! See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance");}}onCardChange==null?void 0:onCardChange(data);},[onCardChange]);var onFocusHandler=(0,_react.useCallback)(function(event){var focusedField=event.nativeEvent.focusedField;if(focusedField){(0,_helpers.focusInput)(inputRef.current);onFocus==null?void 0:onFocus(focusedField);}else{onBlur==null?void 0:onBlur();}},[onFocus,onBlur]);var focus=function focus(){_reactNative.UIManager.dispatchViewManagerCommand((0,_reactNative.findNodeHandle)(inputRef.current),'focus',[]);};var blur=function blur(){_reactNative.UIManager.dispatchViewManagerCommand((0,_reactNative.findNodeHandle)(inputRef.current),'blur',[]);};var clear=function clear(){_reactNative.UIManager.dispatchViewManagerCommand((0,_reactNative.findNodeHandle)(inputRef.current),'clear',[]);};(0,_react.useImperativeHandle)(ref,function(){return{focus:focus,blur:blur,clear:clear};});(0,_react.useLayoutEffect)(function(){var inputRefValue=inputRef.current;if(inputRefValue!==null){(0,_helpers.registerInput)(inputRefValue);return function(){(0,_helpers.unregisterInput)(inputRefValue);if((0,_helpers.currentlyFocusedInput)()===inputRefValue){inputRefValue.blur();}};}return function(){};},[inputRef]);return _react.default.createElement(CardFieldNative,(0,_extends2.default)({ref:inputRef,onCardChange:onCardChangeHandler,onFocusChange:onFocusHandler,postalCodeEnabled:postalCodeEnabled!=null?postalCodeEnabled:true,cardStyle:{backgroundColor:cardStyle==null?void 0:cardStyle.backgroundColor,borderColor:cardStyle==null?void 0:cardStyle.borderColor,borderWidth:cardStyle==null?void 0:cardStyle.borderWidth,borderRadius:cardStyle==null?void 0:cardStyle.borderRadius,cursorColor:cardStyle==null?void 0:cardStyle.cursorColor,fontSize:cardStyle==null?void 0:cardStyle.fontSize,placeholderColor:cardStyle==null?void 0:cardStyle.placeholderColor,textColor:cardStyle==null?void 0:cardStyle.textColor,textErrorColor:cardStyle==null?void 0:cardStyle.textErrorColor,fontFamily:cardStyle==null?void 0:cardStyle.fontFamily},placeholders:{number:placeholders==null?void 0:placeholders.number,expiration:placeholders==null?void 0:placeholders.expiration,cvc:placeholders==null?void 0:placeholders.cvc,postalCode:placeholders==null?void 0:placeholders.postalCode}},props,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:172,columnNumber:7}}));});exports.CardField=CardField;
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.CardField=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _helpers=require("../helpers");var _excluded=["onCardChange","onFocus","onBlur","cardStyle","placeholders","postalCodeEnabled"];var _this=this,_jsxFileName="/Users/acomley/stripe/stripe-react-native/src/components/CardField.tsx";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var CardFieldNative=(0,_reactNative.requireNativeComponent)('CardField');var CardField=(0,_react.forwardRef)(function(_ref,ref){var onCardChange=_ref.onCardChange,onFocus=_ref.onFocus,onBlur=_ref.onBlur,cardStyle=_ref.cardStyle,placeholders=_ref.placeholders,postalCodeEnabled=_ref.postalCodeEnabled,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);var inputRef=(0,_react.useRef)(null);var onCardChangeHandler=(0,_react.useCallback)(function(event){var card=event.nativeEvent;var data={last4:card.last4,expiryMonth:card.expiryMonth,expiryYear:card.expiryYear,complete:card.complete,brand:card.brand,validExpiryDate:card.validExpiryDate,validNumber:card.validNumber,validCVC:card.validCVC};if(card.hasOwnProperty('postalCode')){data.postalCode=card.postalCode||'';}if(card.hasOwnProperty('number')||card.hasOwnProperty('cvc')){data.number=card.number||'';data.cvc=card.cvc||'';if(__DEV__&&onCardChange&&card.complete){console.warn("[stripe-react-native] \u26A0\uFE0F WARNING: You've enabled `dangerouslyGetFullCardDetails`, meaning full card details are being returned. Only do this if you're certain that you fulfill the necessary PCI compliance requirements. Make sure that you're not mistakenly logging or storing full card details! See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance");}}onCardChange==null?void 0:onCardChange(data);},[onCardChange]);var onFocusHandler=(0,_react.useCallback)(function(event){var focusedField=event.nativeEvent.focusedField;if(focusedField){(0,_helpers.focusInput)(inputRef.current);onFocus==null?void 0:onFocus(focusedField);}else{onBlur==null?void 0:onBlur();}},[onFocus,onBlur]);var focus=function focus(){_reactNative.UIManager.dispatchViewManagerCommand((0,_reactNative.findNodeHandle)(inputRef.current),'focus',[]);};var blur=function blur(){_reactNative.UIManager.dispatchViewManagerCommand((0,_reactNative.findNodeHandle)(inputRef.current),'blur',[]);};var clear=function clear(){_reactNative.UIManager.dispatchViewManagerCommand((0,_reactNative.findNodeHandle)(inputRef.current),'clear',[]);};(0,_react.useImperativeHandle)(ref,function(){return{focus:focus,blur:blur,clear:clear};});(0,_react.useLayoutEffect)(function(){var inputRefValue=inputRef.current;if(inputRefValue!==null){(0,_helpers.registerInput)(inputRefValue);return function(){(0,_helpers.unregisterInput)(inputRefValue);if((0,_helpers.currentlyFocusedInput)()===inputRefValue){inputRefValue.blur();}};}return function(){};},[inputRef]);return _react.default.createElement(CardFieldNative,(0,_extends2.default)({ref:inputRef,onCardChange:onCardChangeHandler,onFocusChange:onFocusHandler,postalCodeEnabled:postalCodeEnabled!=null?postalCodeEnabled:true,cardStyle:{backgroundColor:cardStyle==null?void 0:cardStyle.backgroundColor,borderColor:cardStyle==null?void 0:cardStyle.borderColor,borderWidth:cardStyle==null?void 0:cardStyle.borderWidth,borderRadius:cardStyle==null?void 0:cardStyle.borderRadius,cursorColor:cardStyle==null?void 0:cardStyle.cursorColor,fontSize:cardStyle==null?void 0:cardStyle.fontSize,placeholderColor:cardStyle==null?void 0:cardStyle.placeholderColor,textColor:cardStyle==null?void 0:cardStyle.textColor,textErrorColor:cardStyle==null?void 0:cardStyle.textErrorColor,fontFamily:cardStyle==null?void 0:cardStyle.fontFamily},placeholders:{number:placeholders==null?void 0:placeholders.number,expiration:placeholders==null?void 0:placeholders.expiration,cvc:placeholders==null?void 0:placeholders.cvc,postalCode:placeholders==null?void 0:placeholders.postalCode}},props,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:173,columnNumber:7}}));});exports.CardField=CardField;
2
2
  //# sourceMappingURL=CardField.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["CardField.tsx"],"names":["CardFieldNative","CardField","ref","onCardChange","onFocus","onBlur","cardStyle","placeholders","postalCodeEnabled","props","inputRef","onCardChangeHandler","event","card","nativeEvent","data","last4","expiryMonth","expiryYear","complete","brand","validExpiryDate","validNumber","validCVC","hasOwnProperty","postalCode","number","__DEV__","console","warn","onFocusHandler","focusedField","current","focus","UIManager","dispatchViewManagerCommand","blur","clear","inputRefValue","backgroundColor","borderColor","borderWidth","borderRadius","cursorColor","fontSize","placeholderColor","textColor","textErrorColor","fontFamily","expiration","cvc"],"mappings":"qWACA,qDAOA,yCASA,mC,gsCAOA,GAAMA,CAAAA,eAAe,CACnB,wCAAmD,WAAnD,CADF,CA2CO,GAAMC,CAAAA,SAAS,CAAG,sBACvB,cAUEC,GAVF,CAWK,IATDC,CAAAA,YASC,MATDA,YASC,CARDC,OAQC,MARDA,OAQC,CAPDC,MAOC,MAPDA,MAOC,CANDC,SAMC,MANDA,SAMC,CALDC,YAKC,MALDA,YAKC,CAJDC,iBAIC,MAJDA,iBAIC,CAHEC,KAGF,uDACH,GAAMC,CAAAA,QAAQ,CAAG,kBAAY,IAAZ,CAAjB,CAEA,GAAMC,CAAAA,mBAAmB,CAAG,uBAC1B,SAACC,KAAD,CAAyD,CACvD,GAAMC,CAAAA,IAAI,CAAGD,KAAK,CAACE,WAAnB,CAEA,GAAMC,CAAAA,IAA4B,CAAG,CACnCC,KAAK,CAAEH,IAAI,CAACG,KADuB,CAEnCC,WAAW,CAAEJ,IAAI,CAACI,WAFiB,CAGnCC,UAAU,CAAEL,IAAI,CAACK,UAHkB,CAInCC,QAAQ,CAAEN,IAAI,CAACM,QAJoB,CAKnCC,KAAK,CAAEP,IAAI,CAACO,KALuB,CAMnCC,eAAe,CAAER,IAAI,CAACQ,eANa,CAOnCC,WAAW,CAAET,IAAI,CAACS,WAPiB,CAQnCC,QAAQ,CAAEV,IAAI,CAACU,QARoB,CAArC,CAWA,GAAIV,IAAI,CAACW,cAAL,CAAoB,YAApB,CAAJ,CAAuC,CACrCT,IAAI,CAACU,UAAL,CAAkBZ,IAAI,CAACY,UAAL,EAAmB,EAArC,CACD,CACD,GAAIZ,IAAI,CAACW,c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GZC,GAAG,CAAE3C,YAAF,cAAEA,YAAY,CAAE2C,GAHP,CAIZzB,UAAU,CAAElB,YAAF,cAAEA,YAAY,CAAEkB,UAJd,CAjBhB,EAuBMhB,KAvBN,gFADF,CA2BD,CAlIsB,CAAlB,C","sourcesContent":["import type { CardFieldInput } from '../types';\nimport React, {\n forwardRef,\n useCallback,\n useImperativeHandle,\n useLayoutEffect,\n useRef,\n} from 'react';\nimport {\n AccessibilityProps,\n NativeSyntheticEvent,\n requireNativeComponent,\n UIManager,\n StyleProp,\n findNodeHandle,\n ViewStyle,\n} from 'react-native';\nimport {\n currentlyFocusedInput,\n focusInput,\n registerInput,\n unregisterInput,\n} from '../helpers';\n\nconst CardFieldNative =\n requireNativeComponent<CardFieldInput.NativeProps>('CardField');\n\n/**\n * Card Field Component Props\n */\nexport interface Props extends AccessibilityProps {\n style?: StyleProp<ViewStyle>;\n postalCodeEnabled?: boolean;\n cardStyle?: CardFieldInput.Styles;\n placeholders?: CardFieldInput.Placeholders;\n autofocus?: boolean;\n onCardChange?(card: CardFieldInput.Details): void;\n onBlur?(): void;\n onFocus?(focusedField: CardFieldInput.FieldName | null): void;\n testID?: string;\n /**\n * WARNING: If set to `true` the full card number will be returned in the `onCardChange` handler.\n * Only do this if you're certain that you fulfill the necessary PCI compliance requirements.\n * Make sure that you're not mistakenly logging or storing full card details!\n * See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance\n */\n dangerouslyGetFullCardDetails?: boolean;\n}\n\n/**\n * Card Field Component\n *\n * @example\n * ```ts\n * <CardField\n * postalCodeEnabled={false}\n * onCardChange={(cardDetails) => {\n * console.log('card details', cardDetails);\n * setCard(cardDetails);\n * }}\n * style={{height: 50}}\n * />\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport const CardField = forwardRef<CardFieldInput.Methods, Props>(\n (\n {\n onCardChange,\n onFocus,\n onBlur,\n cardStyle,\n placeholders,\n postalCodeEnabled,\n ...props\n },\n ref\n ) => {\n const inputRef = useRef<any>(null);\n\n const onCardChangeHandler = useCallback(\n (event: NativeSyntheticEvent<CardFieldInput.Details>) => {\n const card = event.nativeEvent;\n\n const data: CardFieldInput.Details = {\n last4: card.last4,\n expiryMonth: card.expiryMonth,\n expiryYear: card.expiryYear,\n complete: card.complete,\n brand: card.brand,\n validExpiryDate: card.validExpiryDate,\n validNumber: card.validNumber,\n validCVC: card.validCVC,\n };\n\n if (card.hasOwnProperty('postalCode')) {\n data.postalCode = card.postalCode || '';\n }\n if (card.hasOwnProperty('number')) {\n data.number = card.number || '';\n if (__DEV__ && onCardChange && card.complete) {\n console.warn(\n `[stripe-react-native] ⚠️ WARNING: You've enabled \\`dangerouslyGetFullCardDetails\\`, meaning full card details are being returned. Only do this if you're certain that you fulfill the necessary PCI compliance requirements. Make sure that you're not mistakenly logging or storing full card details! See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance`\n );\n }\n }\n onCardChange?.(data);\n },\n [onCardChange]\n );\n\n const onFocusHandler = useCallback(\n (event) => {\n const { focusedField } = event.nativeEvent;\n if (focusedField) {\n focusInput(inputRef.current);\n onFocus?.(focusedField);\n } else {\n onBlur?.();\n }\n },\n [onFocus, onBlur]\n );\n\n const focus = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(inputRef.current),\n 'focus' as any,\n []\n );\n };\n\n const blur = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(inputRef.current),\n 'blur' as any,\n []\n );\n };\n\n const clear = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(inputRef.current),\n 'clear' as any,\n []\n );\n };\n\n useImperativeHandle(ref, () => ({\n focus,\n blur,\n clear,\n }));\n\n useLayoutEffect(() => {\n const inputRefValue = inputRef.current;\n if (inputRefValue !== null) {\n registerInput(inputRefValue);\n return () => {\n unregisterInput(inputRefValue);\n if (currentlyFocusedInput() === inputRefValue) {\n inputRefValue.blur();\n }\n };\n }\n return () => {};\n }, [inputRef]);\n\n return (\n <CardFieldNative\n ref={inputRef}\n onCardChange={onCardChangeHandler}\n onFocusChange={onFocusHandler}\n postalCodeEnabled={postalCodeEnabled ?? true}\n cardStyle={{\n backgroundColor: cardStyle?.backgroundColor,\n borderColor: cardStyle?.borderColor,\n borderWidth: cardStyle?.borderWidth,\n borderRadius: cardStyle?.borderRadius,\n cursorColor: cardStyle?.cursorColor,\n fontSize: cardStyle?.fontSize,\n placeholderColor: cardStyle?.placeholderColor,\n textColor: cardStyle?.textColor,\n textErrorColor: cardStyle?.textErrorColor,\n fontFamily: cardStyle?.fontFamily,\n }}\n placeholders={{\n number: placeholders?.number,\n expiration: placeholders?.expiration,\n cvc: placeholders?.cvc,\n postalCode: placeholders?.postalCode,\n }}\n {...props}\n />\n );\n }\n);\n"]}
1
+ {"version":3,"sources":["CardField.tsx"],"names":["CardFieldNative","CardField","ref","onCardChange","onFocus","onBlur","cardStyle","placeholders","postalCodeEnabled","props","inputRef","onCardChangeHandler","event","card","nativeEvent","data","last4","expiryMonth","expiryYear","complete","brand","validExpiryDate","validNumber","validCVC","hasOwnProperty","postalCode","number","cvc","__DEV__","console","warn","onFocusHandler","focusedField","current","focus","UIManager","dispatchViewManagerCommand","blur","clear","inputRefValue","backgroundColor","borderColor","borderWidth","borderRadius","cursorColor","fontSize","placeholderColor","textColor","textErrorColor","fontFamily","expiration"],"mappings":"qWACA,qDAOA,yCASA,mC,gsCAOA,GAAMA,CAAAA,eAAe,CACnB,wCAAmD,WAAnD,CADF,CA2CO,GAAMC,CAAAA,SAAS,CAAG,sBACvB,cAUEC,GAVF,CAWK,IATDC,CAAAA,YASC,MATDA,YASC,CARDC,OAQC,MARDA,OAQC,CAPDC,MAOC,MAPDA,MAOC,CANDC,SAMC,MANDA,SAMC,CALDC,YAKC,MALDA,YAKC,CAJDC,iBAIC,MAJDA,iBAIC,CAHEC,KAGF,uDACH,GAAMC,CAAAA,QAAQ,CAAG,kBAAY,IAAZ,CAAjB,CAEA,GAAMC,CAAAA,mBAAmB,CAA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CAKE,SAAS,CAAE,CACTgC,eAAe,CAAElC,SAAF,cAAEA,SAAS,CAAEkC,eADnB,CAETC,WAAW,CAAEnC,SAAF,cAAEA,SAAS,CAAEmC,WAFf,CAGTC,WAAW,CAAEpC,SAAF,cAAEA,SAAS,CAAEoC,WAHf,CAITC,YAAY,CAAErC,SAAF,cAAEA,SAAS,CAAEqC,YAJhB,CAKTC,WAAW,CAAEtC,SAAF,cAAEA,SAAS,CAAEsC,WALf,CAMTC,QAAQ,CAAEvC,SAAF,cAAEA,SAAS,CAAEuC,QANZ,CAOTC,gBAAgB,CAAExC,SAAF,cAAEA,SAAS,CAAEwC,gBAPpB,CAQTC,SAAS,CAAEzC,SAAF,cAAEA,SAAS,CAAEyC,SARb,CASTC,cAAc,CAAE1C,SAAF,cAAEA,SAAS,CAAE0C,cATlB,CAUTC,UAAU,CAAE3C,SAAF,cAAEA,SAAS,CAAE2C,UAVd,CALb,CAiBE,YAAY,CAAE,CACZvB,MAAM,CAAEnB,YAAF,cAAEA,YAAY,CAAEmB,MADV,CAEZwB,UAAU,CAAE3C,YAAF,cAAEA,YAAY,CAAE2C,UAFd,CAGZvB,GAAG,CAAEpB,YAAF,cAAEA,YAAY,CAAEoB,GAHP,CAIZF,UAAU,CAAElB,YAAF,cAAEA,YAAY,CAAEkB,UAJd,CAjBhB,EAuBMhB,KAvBN,gFADF,CA2BD,CAnIsB,CAAlB,C","sourcesContent":["import type { CardFieldInput } from '../types';\nimport React, {\n forwardRef,\n useCallback,\n useImperativeHandle,\n useLayoutEffect,\n useRef,\n} from 'react';\nimport {\n AccessibilityProps,\n NativeSyntheticEvent,\n requireNativeComponent,\n UIManager,\n StyleProp,\n findNodeHandle,\n ViewStyle,\n} from 'react-native';\nimport {\n currentlyFocusedInput,\n focusInput,\n registerInput,\n unregisterInput,\n} from '../helpers';\n\nconst CardFieldNative =\n requireNativeComponent<CardFieldInput.NativeProps>('CardField');\n\n/**\n * Card Field Component Props\n */\nexport interface Props extends AccessibilityProps {\n style?: StyleProp<ViewStyle>;\n postalCodeEnabled?: boolean;\n cardStyle?: CardFieldInput.Styles;\n placeholders?: CardFieldInput.Placeholders;\n autofocus?: boolean;\n onCardChange?(card: CardFieldInput.Details): void;\n onBlur?(): void;\n onFocus?(focusedField: CardFieldInput.FieldName | null): void;\n testID?: string;\n /**\n * WARNING: If set to `true` the full card number will be returned in the `onCardChange` handler.\n * Only do this if you're certain that you fulfill the necessary PCI compliance requirements.\n * Make sure that you're not mistakenly logging or storing full card details!\n * See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance\n */\n dangerouslyGetFullCardDetails?: boolean;\n}\n\n/**\n * Card Field Component\n *\n * @example\n * ```ts\n * <CardField\n * postalCodeEnabled={false}\n * onCardChange={(cardDetails) => {\n * console.log('card details', cardDetails);\n * setCard(cardDetails);\n * }}\n * style={{height: 50}}\n * />\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport const CardField = forwardRef<CardFieldInput.Methods, Props>(\n (\n {\n onCardChange,\n onFocus,\n onBlur,\n cardStyle,\n placeholders,\n postalCodeEnabled,\n ...props\n },\n ref\n ) => {\n const inputRef = useRef<any>(null);\n\n const onCardChangeHandler = useCallback(\n (event: NativeSyntheticEvent<CardFieldInput.Details>) => {\n const card = event.nativeEvent;\n\n const data: CardFieldInput.Details = {\n last4: card.last4,\n expiryMonth: card.expiryMonth,\n expiryYear: card.expiryYear,\n complete: card.complete,\n brand: card.brand,\n validExpiryDate: card.validExpiryDate,\n validNumber: card.validNumber,\n validCVC: card.validCVC,\n };\n\n if (card.hasOwnProperty('postalCode')) {\n data.postalCode = card.postalCode || '';\n }\n if (card.hasOwnProperty('number') || card.hasOwnProperty('cvc')) {\n data.number = card.number || '';\n data.cvc = card.cvc || '';\n if (__DEV__ && onCardChange && card.complete) {\n console.warn(\n `[stripe-react-native] ⚠️ WARNING: You've enabled \\`dangerouslyGetFullCardDetails\\`, meaning full card details are being returned. Only do this if you're certain that you fulfill the necessary PCI compliance requirements. Make sure that you're not mistakenly logging or storing full card details! See the docs for details: https://stripe.com/docs/security/guide#validating-pci-compliance`\n );\n }\n }\n onCardChange?.(data);\n },\n [onCardChange]\n );\n\n const onFocusHandler = useCallback(\n (event) => {\n const { focusedField } = event.nativeEvent;\n if (focusedField) {\n focusInput(inputRef.current);\n onFocus?.(focusedField);\n } else {\n onBlur?.();\n }\n },\n [onFocus, onBlur]\n );\n\n const focus = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(inputRef.current),\n 'focus' as any,\n []\n );\n };\n\n const blur = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(inputRef.current),\n 'blur' as any,\n []\n );\n };\n\n const clear = () => {\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(inputRef.current),\n 'clear' as any,\n []\n );\n };\n\n useImperativeHandle(ref, () => ({\n focus,\n blur,\n clear,\n }));\n\n useLayoutEffect(() => {\n const inputRefValue = inputRef.current;\n if (inputRefValue !== null) {\n registerInput(inputRefValue);\n return () => {\n unregisterInput(inputRefValue);\n if (currentlyFocusedInput() === inputRefValue) {\n inputRefValue.blur();\n }\n };\n }\n return () => {};\n }, [inputRef]);\n\n return (\n <CardFieldNative\n ref={inputRef}\n onCardChange={onCardChangeHandler}\n onFocusChange={onFocusHandler}\n postalCodeEnabled={postalCodeEnabled ?? true}\n cardStyle={{\n backgroundColor: cardStyle?.backgroundColor,\n borderColor: cardStyle?.borderColor,\n borderWidth: cardStyle?.borderWidth,\n borderRadius: cardStyle?.borderRadius,\n cursorColor: cardStyle?.cursorColor,\n fontSize: cardStyle?.fontSize,\n placeholderColor: cardStyle?.placeholderColor,\n textColor: cardStyle?.textColor,\n textErrorColor: cardStyle?.textErrorColor,\n fontFamily: cardStyle?.fontFamily,\n }}\n placeholders={{\n number: placeholders?.number,\n expiration: placeholders?.expiration,\n cvc: placeholders?.cvc,\n postalCode: placeholders?.postalCode,\n }}\n {...props}\n />\n );\n }\n);\n"]}
@@ -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"];var _this=this,_jsxFileName="/Users/acomley/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,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')){data.number=card.number||'';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},onFocusChange:onFocusHandler},props,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:163,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"];var _this=this,_jsxFileName="/Users/acomley/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,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},onFocusChange:onFocusHandler},props,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:164,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","props","inputRef","onFormCompleteHandler","event","card","nativeEvent","data","last4","expiryMonth","expiryYear","complete","brand","country","postalCode","hasOwnProperty","number","__DEV__","console","warn","focus","UIManager","dispatchViewManagerCommand","current","blur","onFocusHandler","focusedField","inputRefValue","backgroundColor","borderColor","borderWidth","borderRadius","cursorColor","fontSize","placeholderColor","textColor","textErrorColor","fontFamily","expiration","cvc"],"mappings":"oWACA,qDAOA,yCASA,mC,0pCAOA,GAAMA,CAAAA,cAAc,CAClB,wCAAiD,UAAjD,CADF,CAiDO,GAAMC,CAAAA,QAAQ,CAAG,sBACtB,cAWEC,GAXF,CAYK,IAVDC,CAAAA,cAUC,MAVDA,cAUC,CATDC,SASC,MATDA,SASC,CAJDC,YAIC,MAJDA,YAIC,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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AAY,CAAEc,UAJd,CAlBhB,CAwBE,aAAa,CAAEW,cAxBjB,EA0BMxB,KA1BN,gFADF,CA8BD,CAtHqB,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 are Android only */\n cardStyle?: CardFormView.Styles;\n // isUserInteractionEnabled?: boolean;\n\n // TODO: will make it public when android-sdk allows for this\n // postalCodeEnabled?: boolean;\n\n /** Android only */\n placeholders?: CardFormView.Placeholders;\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 ...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')) {\n data.number = card.number || '';\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 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","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,0pCAOA,GAAMA,CAAAA,cAAc,CAClB,wCAAiD,UAAjD,CADF,CAiDO,GAAMC,CAAAA,QAAQ,CAAG,sBACtB,cAWEC,GAXF,CAYK,IAVDC,CAAAA,cAUC,MAVDA,cAUC,CATDC,SASC,MATDA,SASC,CAJDC,YAIC,MAJDA,YAIC,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,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A,YAAY,CAAEiB,GAHP,CAIZH,UAAU,CAAEd,YAAF,cAAEA,YAAY,CAAEc,UAJd,CAlBhB,CAwBE,aAAa,CAAEY,cAxBjB,EA0BMzB,KA1BN,gFADF,CA8BD,CAvHqB,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 are Android only */\n cardStyle?: CardFormView.Styles;\n // isUserInteractionEnabled?: boolean;\n\n // TODO: will make it public when android-sdk allows for this\n // postalCodeEnabled?: boolean;\n\n /** Android only */\n placeholders?: CardFormView.Placeholders;\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 ...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 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 _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);}
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,mE,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"],"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 +1 @@
1
- {"version":3,"sources":["SetupIntent.ts"],"names":["Status"],"mappings":"kFA6BYA,CAAAA,M,iCAAAA,M,EAAAA,M,0BAAAA,M,kDAAAA,M,gDAAAA,M,wBAAAA,M,4BAAAA,M,oCAAAA,M,yBAAAA,M,kBAAAA,M","sourcesContent":["import type { Type } from './PaymentMethod';\nimport type { LastPaymentError } from './PaymentIntent';\nimport type { NextAction } from './NextAction';\nimport type * as PaymentMethod from './PaymentMethod';\nexport interface Result {\n id: string;\n clientSecret: string;\n lastSetupError: LastPaymentError | null;\n created: string | null;\n livemode: boolean;\n paymentMethodId: string | null;\n status: Status;\n paymentMethodTypes: Type[];\n usage: FutureUsage;\n description: string | null;\n nextAction: NextAction | null;\n}\n\nexport type ConfirmParams = PaymentMethod.CreateParams;\n\nexport type ConfirmOptions = {};\n\nexport type FutureUsage =\n | 'Unknown'\n | 'None'\n | 'OnSession'\n | 'OffSession'\n | 'OneTime';\n\nexport enum Status {\n Succeeded = 'Succeeded',\n RequiresPaymentMethod = 'RequiresPaymentMethod',\n RequiresConfirmation = 'RequiresConfirmation',\n Canceled = 'Canceled',\n Processing = 'Processing',\n RequiresAction = 'RequiresAction',\n Unknown = 'Unknown',\n}\n"]}
1
+ {"version":3,"sources":["SetupIntent.ts"],"names":["Status"],"mappings":"kFA8CYA,CAAAA,M,iCAAAA,M,EAAAA,M,0BAAAA,M,kDAAAA,M,gDAAAA,M,wBAAAA,M,4BAAAA,M,oCAAAA,M,yBAAAA,M,kBAAAA,M","sourcesContent":["import type { Type } from './PaymentMethod';\nimport type { LastPaymentError } from './PaymentIntent';\nimport type { NextAction } from './NextAction';\nimport type * as PaymentMethod from './PaymentMethod';\nexport interface Result {\n id: string;\n clientSecret: string;\n lastSetupError: LastPaymentError | null;\n created: string | null;\n livemode: boolean;\n paymentMethodId: string | null;\n status: Status;\n paymentMethodTypes: Type[];\n usage: FutureUsage;\n description: string | null;\n nextAction: NextAction | null;\n}\n\nexport type ConfirmParams =\n | PaymentMethod.CardParams\n | PaymentMethod.IdealParams\n | PaymentMethod.OxxoParams\n | PaymentMethod.P24Params\n | PaymentMethod.AlipayParams\n | PaymentMethod.GiropayParams\n | PaymentMethod.SepaParams\n | PaymentMethod.EpsParams\n | PaymentMethod.AuBecsDebitParams\n | PaymentMethod.SofortParams\n | PaymentMethod.GrabPayParams\n | PaymentMethod.FPXParams\n | PaymentMethod.AfterpayClearpayParams\n | PaymentMethod.KlarnaParams\n | PaymentMethod.BancontactParams\n | PaymentMethod.USBankAccountParams;\n// TODO: Change the above back to PaymentMethod.CreateParams when PayPal is supported through SetupIntents\n\nexport type ConfirmOptions = {};\n\nexport type FutureUsage =\n | 'Unknown'\n | 'None'\n | 'OnSession'\n | 'OffSession'\n | 'OneTime';\n\nexport enum Status {\n Succeeded = 'Succeeded',\n RequiresPaymentMethod = 'RequiresPaymentMethod',\n RequiresConfirmation = 'RequiresConfirmation',\n Canceled = 'Canceled',\n Processing = 'Processing',\n RequiresAction = 'RequiresAction',\n Unknown = 'Unknown',\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["CardFieldInput.ts"],"names":["ValidationState"],"mappings":"2FAKYA,CAAAA,e,mDAAAA,e,EAAAA,e,kBAAAA,e,sBAAAA,e,4BAAAA,e,yBAAAA,e,2BAAAA,e","sourcesContent":["import type { NativeSyntheticEvent, StyleProp, ViewStyle } from 'react-native';\nimport type { CardBrand } from '../Token';\n\nexport type FieldName = 'CardNumber' | 'Cvc' | 'ExpiryDate' | 'PostalCode';\n\nexport enum ValidationState {\n Valid = 'Valid',\n Invalid = 'Invalid',\n Incomplete = 'Incomplete',\n Unknown = 'Unknown',\n}\n\nexport interface Details {\n last4: string;\n expiryMonth: number;\n expiryYear: number;\n postalCode?: string;\n brand: CardBrand;\n complete: boolean;\n validExpiryDate: ValidationState;\n validCVC: ValidationState;\n validNumber: ValidationState;\n /**\n * WARNING: Full card details are only returned when the `dangerouslyGetFullCardDetails` prop\n * on the `CardField` component is set to `true`.\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 number?: string;\n}\n\nexport interface Styles {\n borderWidth?: number;\n backgroundColor?: string;\n borderColor?: string;\n borderRadius?: number;\n textColor?: string;\n fontSize?: number;\n placeholderColor?: string;\n cursorColor?: string;\n textErrorColor?: string;\n fontFamily?: string;\n}\n\nexport interface Placeholders {\n number?: string;\n expiration?: string;\n cvc?: string;\n postalCode?: string;\n}\n\n/**\n * @ignore\n */\nexport interface NativeProps {\n style?: StyleProp<ViewStyle>;\n value?: Partial<Details>;\n postalCodeEnabled?: boolean;\n autofocus?: boolean;\n onCardChange(event: NativeSyntheticEvent<Details>): void;\n onFocusChange(\n event: NativeSyntheticEvent<{ focusedField: FieldName | null }>\n ): void;\n cardStyle?: Styles;\n placeholders?: Placeholders;\n}\n\nexport interface Methods {\n focus(): void;\n blur(): void;\n clear(): void;\n}\n"]}
1
+ {"version":3,"sources":["CardFieldInput.ts"],"names":["ValidationState"],"mappings":"2FAKYA,CAAAA,e,mDAAAA,e,EAAAA,e,kBAAAA,e,sBAAAA,e,4BAAAA,e,yBAAAA,e,2BAAAA,e","sourcesContent":["import type { NativeSyntheticEvent, StyleProp, ViewStyle } from 'react-native';\nimport type { CardBrand } from '../Token';\n\nexport type FieldName = 'CardNumber' | 'Cvc' | 'ExpiryDate' | 'PostalCode';\n\nexport enum ValidationState {\n Valid = 'Valid',\n Invalid = 'Invalid',\n Incomplete = 'Incomplete',\n Unknown = 'Unknown',\n}\n\nexport interface Details {\n last4: string;\n expiryMonth: number;\n expiryYear: number;\n postalCode?: string;\n brand: CardBrand;\n complete: boolean;\n validExpiryDate: ValidationState;\n validCVC: ValidationState;\n validNumber: ValidationState;\n /**\n * WARNING: Full card details are only returned when the `dangerouslyGetFullCardDetails` prop\n * on the `CardField` component is set to `true`.\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 number?: string;\n cvc?: string;\n}\n\nexport interface Styles {\n borderWidth?: number;\n backgroundColor?: string;\n borderColor?: string;\n borderRadius?: number;\n textColor?: string;\n fontSize?: number;\n placeholderColor?: string;\n cursorColor?: string;\n textErrorColor?: string;\n fontFamily?: string;\n}\n\nexport interface Placeholders {\n number?: string;\n expiration?: string;\n cvc?: string;\n postalCode?: string;\n}\n\n/**\n * @ignore\n */\nexport interface NativeProps {\n style?: StyleProp<ViewStyle>;\n value?: Partial<Details>;\n postalCodeEnabled?: boolean;\n autofocus?: boolean;\n onCardChange(event: NativeSyntheticEvent<Details>): void;\n onFocusChange(\n event: NativeSyntheticEvent<{ focusedField: FieldName | null }>\n ): void;\n cardStyle?: Styles;\n placeholders?: Placeholders;\n}\n\nexport interface Methods {\n focus(): void;\n blur(): void;\n clear(): void;\n}\n"]}
@@ -34,6 +34,7 @@ export declare type RootStackParamList = {
34
34
  GooglePayScreen: undefined;
35
35
  ACHPaymentScreen: undefined;
36
36
  ACHSetupScreen: undefined;
37
+ PayPalScreen: undefined;
37
38
  };
38
39
  declare global {
39
40
  namespace ReactNavigation {
@@ -0,0 +1 @@
1
+ export default function PayPalScreen(): JSX.Element;
@@ -12,14 +12,19 @@ export interface Props extends AccessibilityProps {
12
12
  testID?: string;
13
13
  /** Only set to `false` when shipping through TestFlight || App Store */
14
14
  testEnv?: boolean;
15
- /** Sets the card holder name (used only on iOS) */
16
- cardHolderName: string;
17
- /** Last 4 digits of the card. Required on Android. */
18
- cardLastFour: string;
19
- /** Sets the card holder name (used only on iOS) */
20
- cardDescription?: string;
21
- /** Optional, only used on iOS */
22
- cardBrand?: Token.CardBrand;
15
+ /** Details of the Issued Card you'd like added to the device's wallet */
16
+ cardDetails: {
17
+ /** The `primary_account_identifier` value from the issued card. */
18
+ primaryAccountIdentifier: string | null;
19
+ /** The card holder name (used only on iOS) */
20
+ name: string;
21
+ /** A user-facing description of the card. Required on Android.*/
22
+ description: string;
23
+ /** Last 4 digits of the card, only used on iOS */
24
+ lastFour?: string;
25
+ /** Optional, only used on iOS */
26
+ brand?: Token.CardBrand;
27
+ };
23
28
  token?: GooglePayCardToken | null;
24
29
  /** Used by stripe to securely obtain card info of the card being provisioned. */
25
30
  ephemeralKey: object;
@@ -37,9 +42,11 @@ export interface Props extends AccessibilityProps {
37
42
  * testEnv={true}
38
43
  * style={styles.myButtonStyle}
39
44
  * iOSButtonStyle="onLightBackground"
40
- * cardHolderName="David Wallace"
41
- * cardLastFour="4242"
42
- * cardBrand="Visa"
45
+ * cardDetails={{
46
+ * primaryAccountIdentifier: "V-123",
47
+ * name: "David Wallace",
48
+ * lastFour: "4242",
49
+ * }}
43
50
  * ephemeralKey={myEphemeralKey} // This object is retrieved from your server. See https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native#update-your-backend
44
51
  * onComplete={(error) => {
45
52
  * Alert.alert(