react-native-payengine 2.0.16 → 2.0.18-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -65
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/com/reactnativepayengine/v2/RNPayEngineNative.kt +65 -3
- package/android/src/main/java/com/reactnativepayengine/v2/securefields/RNPEEvents.kt +1 -0
- package/android/src/main/java/com/reactnativepayengine/v2/securefields/bankaccount/RNBankAccountViewManager.kt +16 -3
- package/android/src/main/java/com/reactnativepayengine/v2/securefields/creditcard/RNPECreditCardViewManager.kt +15 -4
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/KDataCollector.h +4 -25
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/KountAnalyticsViewController.h +0 -20
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/KountPrivate.h +61 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/PayEngineSDK-Swift.h +430 -133
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Info.plist +0 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.abi.json +1848 -5121
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +35 -117
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.private.swiftinterface-e +35 -117
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftinterface +35 -117
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftinterface-e +35 -117
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/PayEngineSDK +0 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/VGSCollectSDK_VGSCollectSDK.bundle/Info.plist +0 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/KDataCollector.h +4 -25
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/KountAnalyticsViewController.h +0 -20
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/KountPrivate.h +61 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/PayEngineSDK-Swift.h +860 -266
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Info.plist +0 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +1848 -5121
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +35 -117
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface-e +35 -117
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +35 -117
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface-e +35 -117
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +1848 -5121
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +35 -117
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface-e +35 -117
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +35 -117
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface-e +35 -117
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/PayEngineSDK +0 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/VGSCollectSDK_VGSCollectSDK.bundle/Info.plist +0 -0
- package/ios/Sources/Classes/RNPEEventEmitter.swift +1 -1
- package/ios/Sources/Classes/RNPayEngineNative.swift +125 -64
- package/ios/Sources/Classes/SecureFields/RNPEEvents.swift +1 -0
- package/ios/Sources/Payengine.m +6 -0
- package/lib/commonjs/components/PayEngine.js +1 -1
- package/lib/commonjs/components/PayEngine.js.map +1 -1
- package/lib/commonjs/components/v2/ApplePay/PEApplePayButton.js +124 -0
- package/lib/commonjs/components/v2/ApplePay/PEApplePayButton.js.map +1 -1
- package/lib/commonjs/components/v2/ApplePay/PEApplePayInterfaces.js +78 -0
- package/lib/commonjs/components/v2/ApplePay/PEApplePayInterfaces.js.map +1 -1
- package/lib/commonjs/components/v2/GooglePay/PEGooglePayAddress.js.map +1 -1
- package/lib/commonjs/components/v2/GooglePay/PEGooglePayButton.js +53 -0
- package/lib/commonjs/components/v2/GooglePay/PEGooglePayButton.js.map +1 -1
- package/lib/commonjs/components/v2/PEPaymentRequest.js +121 -0
- package/lib/commonjs/components/v2/PEPaymentRequest.js.map +1 -1
- package/lib/commonjs/components/v2/PayEngineNative.js +182 -4
- package/lib/commonjs/components/v2/PayEngineNative.js.map +1 -1
- package/lib/commonjs/components/v2/PayEngineProvider.js +52 -0
- package/lib/commonjs/components/v2/PayEngineProvider.js.map +1 -1
- package/lib/commonjs/components/v2/SecureFields/BankAccountView.js +71 -0
- package/lib/commonjs/components/v2/SecureFields/BankAccountView.js.map +1 -1
- package/lib/commonjs/components/v2/SecureFields/CreditCardView.js +82 -0
- package/lib/commonjs/components/v2/SecureFields/CreditCardView.js.map +1 -1
- package/lib/commonjs/components/v2/SecureFields/IPEField.js.map +1 -1
- package/lib/commonjs/components/v2/SecureFields/ITokenizationData.js.map +1 -1
- package/lib/commonjs/components/v2/SecureFields/PEBankAccount.js.map +1 -1
- package/lib/commonjs/components/v2/SecureFields/PECard.js.map +1 -1
- package/lib/commonjs/components/v2/SecureFields/PEKeyboardType.js +20 -3
- package/lib/commonjs/components/v2/SecureFields/PEKeyboardType.js.map +1 -1
- package/lib/commonjs/index.js +17 -13
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/interfaces/index.js +20 -0
- package/lib/commonjs/interfaces/index.js.map +1 -1
- package/lib/commonjs/utils/index.js +26 -0
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/module/components/PayEngine.js +1 -1
- package/lib/module/components/PayEngine.js.map +1 -1
- package/lib/module/components/v2/ApplePay/PEApplePayButton.js +124 -0
- package/lib/module/components/v2/ApplePay/PEApplePayButton.js.map +1 -1
- package/lib/module/components/v2/ApplePay/PEApplePayInterfaces.js +75 -0
- package/lib/module/components/v2/ApplePay/PEApplePayInterfaces.js.map +1 -1
- package/lib/module/components/v2/GooglePay/PEGooglePayAddress.js.map +1 -1
- package/lib/module/components/v2/GooglePay/PEGooglePayButton.js +53 -0
- package/lib/module/components/v2/GooglePay/PEGooglePayButton.js.map +1 -1
- package/lib/module/components/v2/PEPaymentRequest.js +119 -0
- package/lib/module/components/v2/PEPaymentRequest.js.map +1 -1
- package/lib/module/components/v2/PayEngineNative.js +184 -5
- package/lib/module/components/v2/PayEngineNative.js.map +1 -1
- package/lib/module/components/v2/PayEngineProvider.js +51 -0
- package/lib/module/components/v2/PayEngineProvider.js.map +1 -1
- package/lib/module/components/v2/SecureFields/BankAccountView.js +71 -0
- package/lib/module/components/v2/SecureFields/BankAccountView.js.map +1 -1
- package/lib/module/components/v2/SecureFields/CreditCardView.js +82 -0
- package/lib/module/components/v2/SecureFields/CreditCardView.js.map +1 -1
- package/lib/module/components/v2/SecureFields/IPEField.js.map +1 -1
- package/lib/module/components/v2/SecureFields/ITokenizationData.js.map +1 -1
- package/lib/module/components/v2/SecureFields/PEBankAccount.js.map +1 -1
- package/lib/module/components/v2/SecureFields/PECard.js.map +1 -1
- package/lib/module/components/v2/SecureFields/PEKeyboardType.js +16 -1
- package/lib/module/components/v2/SecureFields/PEKeyboardType.js.map +1 -1
- package/lib/module/index.js +10 -5
- package/lib/module/index.js.map +1 -1
- package/lib/module/interfaces/index.js +19 -0
- package/lib/module/interfaces/index.js.map +1 -1
- package/lib/module/utils/index.js +27 -0
- package/lib/module/utils/index.js.map +1 -1
- package/lib/typescript/components/PayEngine.d.ts +1 -1
- package/lib/typescript/components/v2/ApplePay/PEApplePayButton.d.ts +217 -12
- package/lib/typescript/components/v2/ApplePay/PEApplePayInterfaces.d.ts +180 -1
- package/lib/typescript/components/v2/GooglePay/PEGooglePayAddress.d.ts +30 -0
- package/lib/typescript/components/v2/GooglePay/PEGooglePayButton.d.ts +99 -0
- package/lib/typescript/components/v2/PEPaymentRequest.d.ts +130 -9
- package/lib/typescript/components/v2/PayEngineNative.d.ts +165 -7
- package/lib/typescript/components/v2/PayEngineProvider.d.ts +51 -0
- package/lib/typescript/components/v2/SecureFields/BankAccountView.d.ts +103 -0
- package/lib/typescript/components/v2/SecureFields/CreditCardView.d.ts +114 -0
- package/lib/typescript/components/v2/SecureFields/IPEField.d.ts +49 -0
- package/lib/typescript/components/v2/SecureFields/ITokenizationData.d.ts +14 -0
- package/lib/typescript/components/v2/SecureFields/PEBankAccount.d.ts +36 -0
- package/lib/typescript/components/v2/SecureFields/PECard.d.ts +44 -0
- package/lib/typescript/components/v2/SecureFields/PEKeyboardType.d.ts +16 -1
- package/lib/typescript/index.d.ts +11 -5
- package/lib/typescript/interfaces/index.d.ts +35 -1
- package/lib/typescript/utils/index.d.ts +21 -0
- package/package.json +6 -3
- package/react-native-payengine.podspec +1 -1
- package/src/components/PayEngine.tsx +1 -1
- package/src/components/v2/ApplePay/PEApplePayButton.tsx +225 -12
- package/src/components/v2/ApplePay/PEApplePayInterfaces.ts +221 -8
- package/src/components/v2/GooglePay/PEGooglePayAddress.ts +39 -1
- package/src/components/v2/GooglePay/PEGooglePayButton.tsx +113 -9
- package/src/components/v2/PEPaymentRequest.ts +151 -13
- package/src/components/v2/PayEngineNative.tsx +196 -9
- package/src/components/v2/PayEngineProvider.tsx +52 -1
- package/src/components/v2/SecureFields/BankAccountView.tsx +108 -1
- package/src/components/v2/SecureFields/CreditCardView.tsx +118 -1
- package/src/components/v2/SecureFields/IPEField.ts +55 -0
- package/src/components/v2/SecureFields/ITokenizationData.ts +17 -2
- package/src/components/v2/SecureFields/PEBankAccount.ts +42 -0
- package/src/components/v2/SecureFields/PECard.ts +52 -0
- package/src/components/v2/SecureFields/PEKeyboardType.ts +18 -1
- package/src/index.tsx +23 -5
- package/src/interfaces/index.ts +40 -2
- package/src/utils/index.ts +21 -0
- package/android/.gradle/6.1.1/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/6.1.1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/6.1.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/6.1.1/gc.properties +0 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/CustomWindow.h +0 -25
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/UIControl+CustomControl.h +0 -33
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/UIViewController+TouchControl.h +0 -27
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/CustomWindow.h +0 -25
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/UIControl+CustomControl.h +0 -33
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/UIViewController+TouchControl.h +0 -27
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RNPEEventEmitter","NativeModules","COMPONENT_NAME","RNPEBankAccountView","requireNativeComponent","RNPEBankAccountViewManager","UIManager","peEventEmitter","NativeEventEmitter","PEBankAccountView","React","forwardRef","props","ref","formRef","useRef","height","setHeight","useState","useImperativeHandle","submit","data","Promise","resolve","reject","Error","listener","addListener","args","remove","error","bankAccount","json","JSON","parse","callNativeMethod","merchantId","additionalData","showKeyboard","hideKeyboard","useCallback","methodName","params","viewId","findNodeHandle","current","commandId","Commands","toString","Platform","OS","Number","dispatchViewManagerCommand","useEffect","eventListener","width","_","frameHeight","stringify","additionalFields"],"sources":["BankAccountView.tsx"],"sourcesContent":["\nimport * as React from 'react';\nimport { requireNativeComponent, NativeModules, NativeEventEmitter, ViewProps, findNodeHandle, UIManager, ActivityIndicator, Platform } from 'react-native';\nimport type IPEField from './IPEField';\nimport type PEBankAccount from './PEBankAccount';\nimport type ITokenizationData from './ITokenizationData';\n\nconst { RNPEEventEmitter } = NativeModules;\n\ninterface NativePEBankAccountViewProps extends ViewProps {\n additionalFields: string;\n}\n\nconst COMPONENT_NAME = 'RNPEBankAccountView'\nconst RNPEBankAccountView = requireNativeComponent<NativePEBankAccountViewProps>(COMPONENT_NAME);\n// @ts-ignore\nconst RNPEBankAccountViewManager = UIManager[COMPONENT_NAME]\n\nconst peEventEmitter = new NativeEventEmitter(RNPEEventEmitter);\n\nexport interface PEBankAccountViewProps {\n additionalFields?: IPEField[];\n}\n\nexport interface PEBankAccountViewMethods {\n submit: (data: ITokenizationData) => Promise<PEBankAccount>;\n showKeyboard: () => void;\n hideKeyboard: () => void;\n}\n\nexport const PEBankAccountView = React.forwardRef<\n PEBankAccountViewMethods,\n PEBankAccountViewProps\n>((props, ref) => {\n const formRef = React.useRef<any>();\n const [height, setHeight] = React.useState(0);\n\n React.useImperativeHandle(ref, () => ({\n submit: async (data: ITokenizationData = {}) => {\n return new Promise((resolve, reject) => {\n if (height === 0) {\n return reject(new Error('Form is not ready'))\n }\n \n const listener = peEventEmitter.addListener('onBankAccountRespond', args => {\n listener.remove()\n\n const { error, bankAccount: json } = args;\n if (error) {\n reject(new Error(error))\n } else {\n const bankAccount = JSON.parse(json) as PEBankAccount;\n resolve(bankAccount)\n }\n });\n\n callNativeMethod(\"submit\", [data.merchantId, data.additionalData],)\n });\n },\n showKeyboard: () => {\n callNativeMethod(\"showKeyboard\")\n },\n hideKeyboard: () => {\n callNativeMethod(\"hideKeyboard\")\n }\n }));\n\n const callNativeMethod = React.useCallback((methodName: string, params: any[] = []) => {\n const viewId = findNodeHandle(formRef.current);\n let commandId = RNPEBankAccountViewManager.Commands[methodName].toString()\n if (Platform.OS === 'ios') {\n commandId = Number(commandId)\n }\n UIManager.dispatchViewManagerCommand(\n viewId,\n commandId,\n params,\n );\n }, [formRef.current])\n\n\n React.useEffect(() => {\n const eventListener = peEventEmitter.addListener('onSizeChanges', args => {\n const { width: _, height: frameHeight } = args;\n setHeight(frameHeight);\n });\n return () => eventListener.remove();\n }, []);\n\n return (\n <>\n {height === 0 && <ActivityIndicator />}\n <RNPEBankAccountView ref={formRef} additionalFields={JSON.stringify(props.additionalFields ?? [])} style={{ height: height }} />\n </>\n );\n});\n"],"mappings":";;;;;;;AACA;;AACA;;;;;;AAKA,MAAM;EAAEA;AAAF,IAAuBC,0BAA7B;AAMA,MAAMC,cAAc,GAAG,qBAAvB;AACA,MAAMC,mBAAmB,GAAG,IAAAC,mCAAA,EAAqDF,cAArD,CAA5B,C,CACA;;AACA,MAAMG,0BAA0B,GAAGC,sBAAA,CAAUJ,cAAV,CAAnC;AAEA,MAAMK,cAAc,GAAG,IAAIC,+BAAJ,CAAuBR,gBAAvB,CAAvB;AAYO,MAAMS,iBAAiB,gBAAGC,KAAK,CAACC,UAAN,CAG/B,CAACC,KAAD,EAAQC,GAAR,KAAgB;EAChB,MAAMC,OAAO,GAAGJ,KAAK,CAACK,MAAN,EAAhB;EACA,MAAM,CAACC,MAAD,EAASC,SAAT,IAAsBP,KAAK,CAACQ,QAAN,CAAe,CAAf,CAA5B;EAEAR,KAAK,CAACS,mBAAN,CAA0BN,GAA1B,EAA+B,OAAO;IACpCO,MAAM,EAAE,kBAAwC;MAAA,IAAjCC,IAAiC,uEAAP,EAAO;MAC9C,OAAO,IAAIC,OAAJ,CAAY,CAACC,OAAD,EAAUC,MAAV,KAAqB;QACtC,IAAIR,MAAM,KAAK,CAAf,EAAkB;UAChB,OAAOQ,MAAM,CAAC,IAAIC,KAAJ,CAAU,mBAAV,CAAD,CAAb;QACD;;QAED,MAAMC,QAAQ,GAAGnB,cAAc,CAACoB,WAAf,CAA2B,sBAA3B,EAAmDC,IAAI,IAAI;UAC1EF,QAAQ,CAACG,MA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MAAM;QAAE2B,KAAK,EAAEC,CAAT;QAAYxC,MAAM,EAAEyC;MAApB,IAAoC7B,IAA1C;MACAX,SAAS,CAACwC,WAAD,CAAT;IACD,CAHqB,CAAtB;IAIA,OAAO,MAAMH,aAAa,CAACzB,MAAd,EAAb;EACD,CAND,EAMG,EANH;EAQA,oBACE,0CACGb,MAAM,KAAK,CAAX,iBAAgB,oBAAC,8BAAD,OADnB,eAEE,oBAAC,mBAAD;IAAqB,GAAG,EAAEF,OAA1B;IAAmC,gBAAgB,EAAEmB,IAAI,CAACyB,SAAL,CAAe9C,KAAK,CAAC+C,gBAAN,IAA0B,EAAzC,CAArD;IAAmG,KAAK,EAAE;MAAE3C,MAAM,EAAEA;IAAV;EAA1G,EAFF,CADF;AAMD,CAjEgC,CAA1B"}
|
|
1
|
+
{"version":3,"names":["RNPEEventEmitter","NativeModules","COMPONENT_NAME","RNPEBankAccountView","requireNativeComponent","RNPEBankAccountViewManager","UIManager","peEventEmitter","NativeEventEmitter","PEBankAccountView","React","forwardRef","props","ref","formRef","useRef","height","setHeight","useState","useImperativeHandle","submit","data","Promise","resolve","reject","Error","listener","addListener","args","remove","error","bankAccount","json","JSON","parse","callNativeMethod","merchantId","additionalData","showKeyboard","hideKeyboard","useCallback","methodName","params","viewId","findNodeHandle","current","commandId","Commands","toString","Platform","OS","Number","dispatchViewManagerCommand","useEffect","eventListener","width","_","frameHeight","stringify","additionalFields"],"sources":["BankAccountView.tsx"],"sourcesContent":["\nimport * as React from 'react';\nimport { requireNativeComponent, NativeModules, NativeEventEmitter, type ViewProps, findNodeHandle, UIManager, ActivityIndicator, Platform } from 'react-native';\nimport type IPEField from './IPEField';\nimport type PEBankAccount from './PEBankAccount';\nimport type ITokenizationData from './ITokenizationData';\n\nconst { RNPEEventEmitter } = NativeModules;\n\ninterface NativePEBankAccountViewProps extends ViewProps {\n additionalFields: string;\n}\n\nconst COMPONENT_NAME = 'RNPEBankAccountView'\nconst RNPEBankAccountView = requireNativeComponent<NativePEBankAccountViewProps>(COMPONENT_NAME);\n// @ts-ignore\nconst RNPEBankAccountViewManager = UIManager[COMPONENT_NAME]\n\nconst peEventEmitter = new NativeEventEmitter(RNPEEventEmitter);\n\n/**\n * Props for the `PEBankAccountView` component.\n *\n * Allows optional configuration of additional input fields that can be rendered\n * alongside the standard bank account fields.\n *\n * These fields can be used to collect extra information such as account holder type,\n * billing address, or custom metadata required by the merchant.\n *\n * @category SecureFields\n *\n * @example\n * ```ts\n * const fields: IPEField[] = [\n * {\n * name: \"accountHolderType\",\n * type: \"text\",\n * placeholder: \"Account Holder Type\",\n * keyboardType: PEKeyboardType.Alphabet,\n * isRequired: false\n * }\n * ];\n *\n * <PEBankAccountView additionalFields={fields} />\n * ```\n */\nexport interface PEBankAccountViewProps {\n /**\n * (Optional) A list of additional fields to be displayed in the bank account form.\n *\n * These are rendered below the standard account number and routing number fields.\n */\n additionalFields?: IPEField[];\n}\n\n\n/**\n * Provides methods to control and interact with the PayEngine Bank Account input view.\n *\n * This interface defines methods for submitting bank account details for tokenization\n * and managing keyboard visibility.\n *\n * @category SecureFields\n */\nexport interface PEBankAccountViewMethods {\n /**\n * Submits the entered bank account information to PayEngine for tokenization.\n *\n * @param data - Optional merchant info and additional metadata.\n * @returns A promise that resolves to a tokenized bank account object (`PEBankAccount`).\n *\n * @example\n * ```ts\n * const result = await bankAccountRef.current?.submit({\n * merchantId: \"merchant_456\",\n * additionalData: { accountType: \"checking\" }\n * });\n * ```\n */\n submit: (data: ITokenizationData) => Promise<PEBankAccount>;\n\n /**\n * Programmatically displays the keyboard for the bank account input fields.\n */\n showKeyboard: () => void;\n\n /**\n * Programmatically hides the keyboard for the bank account input fields.\n */\n hideKeyboard: () => void;\n}\n\n\n/**\n * A secure form widget for entering a customer's bank account information.\n *\n * [PEBankAccountView] provides a UI component for securely collecting bank account details.\n * It does not store data locally and instead tokenizes the information using PayEngine.\n *\n * ## Features:\n * - Securely collects bank account details.\n * - Supports additional customizable fields.\n * - Provides methods to show/hide the keyboard.\n * - Allows tokenizing the entered data for safe storage.\n *\n * ## Usage Example:\n *\n * ```tsx\n * const formRef = React.createRef<PEBankAccountViewMethods>();\n *\n * return (\n * <View style={styles.container}>\n * <Text>Welcome to PayEngine React Native SDK example</Text>\n * <View style={{ width: '100%' }}>\n * <PEBankAccountView ref={formRef} />\n * <Button disabled={submitting} onPress={() => createBankAccount()} title=\"Create Bank Account\" />\n * </View>\n * <ScrollView style={{ flex: 1, width: '100%', backgroundColor: 'lightyellow', padding: 10, marginVertical: 20 }}>\n * <Text>{JSON.stringify(secureFieldsResult, null, 4)}</Text>\n * </ScrollView>\n * </View>\n * );\n * ```\n *\n * ## How It Works:\n * 1. Create an instance of [PEBankAccountView], optionally passing additional fields.\n * 2. Display the form inside your widget tree.\n * 3. Use [showKeyboard] and [hideKeyboard] to manage input focus.\n * 4. Call [submit] to securely send the bank account data and receive a token.\n *\n * ## Methods:\n * - **`showKeyboard()`**: Manually shows the on-screen keyboard.\n * - **`hideKeyboard()`**: Hides the on-screen keyboard.\n * - **`submit()`**: Submits the entered data and retrieves a tokenized version of the bank account data.\n *\n * @category SecureFields\n */\nexport const PEBankAccountView = React.forwardRef<\n PEBankAccountViewMethods,\n PEBankAccountViewProps\n>((props, ref) => {\n const formRef = React.useRef<any>();\n const [height, setHeight] = React.useState(0);\n\n React.useImperativeHandle(ref, () => ({\n submit: async (data: ITokenizationData = {}) => {\n return new Promise((resolve, reject) => {\n if (height === 0) {\n return reject(new Error('Form is not ready'))\n }\n \n const listener = peEventEmitter.addListener('onBankAccountRespond', args => {\n listener.remove()\n\n const { error, bankAccount: json } = args;\n if (error) {\n reject(new Error(error))\n } else {\n const bankAccount = JSON.parse(json) as PEBankAccount;\n resolve(bankAccount)\n }\n });\n\n callNativeMethod(\"submit\", [data.merchantId, data.additionalData],)\n });\n },\n showKeyboard: () => {\n callNativeMethod(\"showKeyboard\")\n },\n hideKeyboard: () => {\n callNativeMethod(\"hideKeyboard\")\n }\n }));\n\n const callNativeMethod = React.useCallback((methodName: string, params: any[] = []) => {\n const viewId = findNodeHandle(formRef.current);\n let commandId = RNPEBankAccountViewManager.Commands[methodName].toString()\n if (Platform.OS === 'ios') {\n commandId = Number(commandId)\n }\n UIManager.dispatchViewManagerCommand(\n viewId,\n commandId,\n params,\n );\n }, [formRef.current])\n\n\n React.useEffect(() => {\n const eventListener = peEventEmitter.addListener('onSizeChanges', args => {\n const { width: _, height: frameHeight } = args;\n setHeight(frameHeight);\n });\n return () => eventListener.remove();\n }, []);\n\n return (\n <>\n {height === 0 && <ActivityIndicator />}\n <RNPEBankAccountView ref={formRef} additionalFields={JSON.stringify(props.additionalFields ?? [])} style={{ height: height }} />\n </>\n );\n});\n"],"mappings":";;;;;;;AACA;;AACA;;;;;;AAKA,MAAM;EAAEA;AAAF,IAAuBC,0BAA7B;AAMA,MAAMC,cAAc,GAAG,qBAAvB;AACA,MAAMC,mBAAmB,GAAG,IAAAC,mCAAA,EAAqDF,cAArD,CAA5B,C,CACA;;AACA,MAAMG,0BAA0B,GAAGC,sBAAA,CAAUJ,cAAV,CAAnC;AAEA,MAAMK,cAAc,GAAG,IAAIC,+BAAJ,CAAuBR,gBAAvB,CAAvB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMS,iBAAiB,gBAAGC,KAAK,CAACC,UAAN,CAG/B,CAACC,KAAD,EAAQC,GAAR,KAAgB;EAChB,MAAMC,OAAO,GAAGJ,KAAK,CAACK,MAAN,EAAhB;EACA,MAA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AAC+B,OAAvB,CAAf;IACA,IAAIC,SAAS,GAAGzC,0BAA0B,CAAC0C,QAA3B,CAAoCN,UAApC,EAAgDO,QAAhD,EAAhB;;IACA,IAAIC,qBAAA,CAASC,EAAT,KAAgB,KAApB,EAA2B;MACzBJ,SAAS,GAAGK,MAAM,CAACL,SAAD,CAAlB;IACD;;IACDxC,sBAAA,CAAU8C,0BAAV,CACET,MADF,EAEEG,SAFF,EAGEJ,MAHF;EAKD,CAXwB,EAWtB,CAAC5B,OAAO,CAAC+B,OAAT,CAXsB,CAAzB;EAcAnC,KAAK,CAAC2C,SAAN,CAAgB,MAAM;IACpB,MAAMC,aAAa,GAAG/C,cAAc,CAACoB,WAAf,CAA2B,eAA3B,EAA4CC,IAAI,IAAI;MACxE,MAAM;QAAE2B,KAAK,EAAEC,CAAT;QAAYxC,MAAM,EAAEyC;MAApB,IAAoC7B,IAA1C;MACAX,SAAS,CAACwC,WAAD,CAAT;IACD,CAHqB,CAAtB;IAIA,OAAO,MAAMH,aAAa,CAACzB,MAAd,EAAb;EACD,CAND,EAMG,EANH;EAQA,oBACE,0CACGb,MAAM,KAAK,CAAX,iBAAgB,oBAAC,8BAAD,OADnB,eAEE,oBAAC,mBAAD;IAAqB,GAAG,EAAEF,OAA1B;IAAmC,gBAAgB,EAAEmB,IAAI,CAACyB,SAAL,CAAe9C,KAAK,CAAC+C,gBAAN,IAA0B,EAAzC,CAArD;IAAmG,KAAK,EAAE;MAAE3C,MAAM,EAAEA;IAAV;EAA1G,EAFF,CADF;AAMD,CAjEgC,CAA1B"}
|
|
@@ -21,6 +21,88 @@ const RNPECreditCardView = (0, _reactNative.requireNativeComponent)(COMPONENT_NA
|
|
|
21
21
|
|
|
22
22
|
const RNPECreditCardViewManager = _reactNative.UIManager[COMPONENT_NAME];
|
|
23
23
|
const peEventEmitter = new _reactNative.NativeEventEmitter(RNPEEventEmitter);
|
|
24
|
+
/**
|
|
25
|
+
* Props for the `PECreditCardView` component.
|
|
26
|
+
*
|
|
27
|
+
* Allows optional configuration of additional input fields that can be rendered
|
|
28
|
+
* alongside the standard credit card fields.
|
|
29
|
+
*
|
|
30
|
+
* These fields can be used to collect extra information such as ZIP code, billing address,
|
|
31
|
+
* or custom metadata required by the merchant.
|
|
32
|
+
*
|
|
33
|
+
* @category SecureFields
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const fields: IPEField[] = [
|
|
38
|
+
* {
|
|
39
|
+
* name: "zipCode",
|
|
40
|
+
* type: "text",
|
|
41
|
+
* placeholder: "ZIP Code",
|
|
42
|
+
* keyboardType: PEKeyboardType.Numeric,
|
|
43
|
+
* isRequired: true
|
|
44
|
+
* }
|
|
45
|
+
* ];
|
|
46
|
+
*
|
|
47
|
+
* <PECreditCardView additionalFields={fields} />
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* A secure form for entering a customer's credit card information safely.
|
|
53
|
+
*
|
|
54
|
+
* [PECreditCardView] provides an interface for users to input their credit card details securely.
|
|
55
|
+
* It integrates with PayEngine to tokenize the card details and forward them to a PCI-compliant
|
|
56
|
+
* third party without storing sensitive information locally.
|
|
57
|
+
*
|
|
58
|
+
* ## How It Works
|
|
59
|
+
*
|
|
60
|
+
* 1. Create an instance of [PECreditCardView], optionally passing additional fields.
|
|
61
|
+
* 2. Display the form inside your UI.
|
|
62
|
+
* 3. Once the user enters their details, call [submit] to securely process and retrieve a tokenized version of the card.
|
|
63
|
+
* 4. Use [showKeyboard] and [hideKeyboard] to manually control the keyboard.
|
|
64
|
+
*
|
|
65
|
+
* ## Example Usage
|
|
66
|
+
*
|
|
67
|
+
* ```tsx
|
|
68
|
+
* const formRef = React.createRef<PECreditCardViewMethods>();
|
|
69
|
+
*
|
|
70
|
+
*
|
|
71
|
+
* const additionalFields = [
|
|
72
|
+
* {
|
|
73
|
+
* name: 'address_zip',
|
|
74
|
+
* type: 'text',
|
|
75
|
+
* placeholder: 'Zip code',
|
|
76
|
+
* keyboardType: PEKeyboardType.alphabet,
|
|
77
|
+
* isRequired: true,
|
|
78
|
+
* pattern: '^(?:\\d{5}(?:-\\d{4})?|[ABCEGHJKLMNPRSTVXY]\\d[A-Z] ?\\d[A-Z]\\d)$'
|
|
79
|
+
* }
|
|
80
|
+
* ]
|
|
81
|
+
*
|
|
82
|
+
* return (
|
|
83
|
+
* <View style={styles.container}>
|
|
84
|
+
* <Text>Welcome to PayEngine React Native SDK example</Text>
|
|
85
|
+
* <View style={{ width: '100%' }}>
|
|
86
|
+
* <PECreditCardView ref={formRef} additionalFields={additionalFields} />
|
|
87
|
+
* <Button disabled={submitting} onPress={() => createCard()} title="Create Card" />
|
|
88
|
+
* <Button onPress={() => formRef.current?.showKeyboard()} title="Show keyboard" />
|
|
89
|
+
* <Button onPress={() => formRef.current?.hideKeyboard()} title="Hide keyboard" />
|
|
90
|
+
* </View>
|
|
91
|
+
* <ScrollView style={{ flex: 1, width: '100%', backgroundColor: 'lightyellow', padding: 10, marginVertical: 20 }}>
|
|
92
|
+
* <Text>{JSON.stringify(secureFieldsResult, null, 4)}</Text>
|
|
93
|
+
* </ScrollView>
|
|
94
|
+
* </View>
|
|
95
|
+
* );
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* ## Features:
|
|
99
|
+
* - Securely collects credit card details.
|
|
100
|
+
* - Supports additional customizable fields.
|
|
101
|
+
* - Provides methods to show/hide the keyboard.
|
|
102
|
+
* - Allows submitting the entered data for tokenization and safe storage.
|
|
103
|
+
*
|
|
104
|
+
* @category SecureFields
|
|
105
|
+
*/
|
|
24
106
|
const PECreditCardView = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
25
107
|
const formRef = React.useRef();
|
|
26
108
|
const [height, setHeight] = React.useState(0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RNPEEventEmitter","NativeModules","COMPONENT_NAME","RNPECreditCardView","requireNativeComponent","RNPECreditCardViewManager","UIManager","peEventEmitter","NativeEventEmitter","PECreditCardView","React","forwardRef","props","ref","formRef","useRef","height","setHeight","useState","useImperativeHandle","submit","data","Promise","resolve","reject","Error","listener","addListener","args","remove","error","card","json","JSON","parse","callNativeMethod","merchantId","additionalData","showKeyboard","hideKeyboard","useCallback","methodName","params","console","log","viewId","findNodeHandle","current","commandId","Commands","toString","Platform","OS","Number","dispatchViewManagerCommand","useEffect","eventListener","width","_","frameHeight","stringify","additionalFields"],"sources":["CreditCardView.tsx"],"sourcesContent":["\nimport * as React from 'react';\nimport { requireNativeComponent, NativeModules, NativeEventEmitter, ViewProps, Platform, findNodeHandle, UIManager, ActivityIndicator } from 'react-native';\nimport type IPEField from './IPEField';\nimport type PECard from './PECard';\nimport type ITokenizationData from './ITokenizationData';\n\nconst { RNPEEventEmitter } = NativeModules;\n\ninterface NativePECreditCardViewProps extends ViewProps {\n additionalFields: string;\n}\n\nconst COMPONENT_NAME = 'RNPECreditCardView'\nconst RNPECreditCardView = requireNativeComponent<NativePECreditCardViewProps>(COMPONENT_NAME);\n// @ts-ignore\nconst RNPECreditCardViewManager = UIManager[COMPONENT_NAME]\nconst peEventEmitter = new NativeEventEmitter(RNPEEventEmitter);\n\nexport interface PECreditCardViewProps {\n additionalFields?: IPEField[];\n}\n\nexport interface PECreditCardViewMethods {\n submit: (data: ITokenizationData) => Promise<PECard>;\n showKeyboard: () => void;\n hideKeyboard: () => void;\n}\n\nexport const PECreditCardView = React.forwardRef<\n PECreditCardViewMethods,\n PECreditCardViewProps\n>((props, ref) => {\n const formRef = React.useRef<any>();\n const [height, setHeight] = React.useState(0);\n\n React.useImperativeHandle(ref, () => ({\n submit: async (data: ITokenizationData = {}) => {\n return new Promise((resolve, reject) => {\n if (height === 0) {\n return reject(new Error('Form is not ready'))\n }\n\n const listener = peEventEmitter.addListener('onCardRespond', args => {\n listener.remove()\n\n const { error, card: json } = args;\n if (error) {\n reject(new Error(error))\n } else {\n const card = JSON.parse(json) as PECard;\n resolve(card)\n }\n });\n\n callNativeMethod(\"submit\", [data.merchantId, data.additionalData])\n });\n },\n showKeyboard: () => {\n callNativeMethod(\"showKeyboard\")\n },\n hideKeyboard: () => {\n callNativeMethod(\"hideKeyboard\")\n }\n }));\n\n const callNativeMethod = React.useCallback((methodName: string, params: any[] = []) => {\n console.log(\"callNativeMethod\", methodName, params)\n const viewId = findNodeHandle(formRef.current);\n let commandId = RNPECreditCardViewManager.Commands[methodName].toString()\n if (Platform.OS === 'ios') {\n commandId = Number(commandId)\n }\n UIManager.dispatchViewManagerCommand(\n viewId,\n commandId,\n params,\n );\n }, [formRef.current])\n\n React.useEffect(() => {\n const eventListener = peEventEmitter.addListener('onSizeChanges', args => {\n const { width: _, height: frameHeight } = args;\n setHeight(frameHeight);\n });\n\n return () => eventListener.remove();\n }, []);\n\n\n return (\n <>\n {height === 0 && <ActivityIndicator />}\n <RNPECreditCardView ref={formRef} additionalFields={JSON.stringify(props.additionalFields ?? [])} style={{ height: height }} />\n </>\n );\n});\n"],"mappings":";;;;;;;AACA;;AACA;;;;;;AAKA,MAAM;EAAEA;AAAF,IAAuBC,0BAA7B;AAMA,MAAMC,cAAc,GAAG,oBAAvB;AACA,MAAMC,kBAAkB,GAAG,IAAAC,mCAAA,EAAoDF,cAApD,CAA3B,C,CACA;;AACA,MAAMG,yBAAyB,GAAGC,sBAAA,CAAUJ,cAAV,CAAlC;AACA,MAAMK,cAAc,GAAG,IAAIC,+BAAJ,CAAuBR,gBAAvB,CAAvB;AAYO,MAAMS,gBAAgB,gBAAGC,KAAK,CAACC,UAAN,CAG9B,CAACC,KAAD,EAAQC,GAAR,KAAgB;EAChB,MAAMC,OAAO,GAAGJ,KAAK,CAACK,MAAN,EAAhB;EACA,MAAM,CAACC,MAAD,EAASC,SAAT,IAAsBP,KAAK,CAACQ,QAAN,CAAe,CAAf,CAA5B;EAEAR,KAAK,CAACS,mBAAN,CAA0BN,GAA1B,EAA+B,OAAO;IACpCO,MAAM,EAAE,kBAAwC;MAAA,I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/C,EAAhB;;IACA,IAAIC,qBAAA,CAASC,EAAT,KAAgB,KAApB,EAA2B;MACzBJ,SAAS,GAAGK,MAAM,CAACL,SAAD,CAAlB;IACD;;IACD1C,sBAAA,CAAUgD,0BAAV,CACET,MADF,EAEEG,SAFF,EAGEN,MAHF;EAKD,CAZwB,EAYtB,CAAC5B,OAAO,CAACiC,OAAT,CAZsB,CAAzB;EAcArC,KAAK,CAAC6C,SAAN,CAAgB,MAAM;IACpB,MAAMC,aAAa,GAAGjD,cAAc,CAACoB,WAAf,CAA2B,eAA3B,EAA4CC,IAAI,IAAI;MACxE,MAAM;QAAE6B,KAAK,EAAEC,CAAT;QAAY1C,MAAM,EAAE2C;MAApB,IAAoC/B,IAA1C;MACAX,SAAS,CAAC0C,WAAD,CAAT;IACD,CAHqB,CAAtB;IAKA,OAAO,MAAMH,aAAa,CAAC3B,MAAd,EAAb;EACD,CAPD,EAOG,EAPH;EAUA,oBACE,0CACGb,MAAM,KAAK,CAAX,iBAAgB,oBAAC,8BAAD,OADnB,eAEE,oBAAC,kBAAD;IAAoB,GAAG,EAAEF,OAAzB;IAAkC,gBAAgB,EAAEmB,IAAI,CAAC2B,SAAL,CAAehD,KAAK,CAACiD,gBAAN,IAA0B,EAAzC,CAApD;IAAkG,KAAK,EAAE;MAAE7C,MAAM,EAAEA;IAAV;EAAzG,EAFF,CADF;AAMD,CAnE+B,CAAzB"}
|
|
1
|
+
{"version":3,"names":["RNPEEventEmitter","NativeModules","COMPONENT_NAME","RNPECreditCardView","requireNativeComponent","RNPECreditCardViewManager","UIManager","peEventEmitter","NativeEventEmitter","PECreditCardView","React","forwardRef","props","ref","formRef","useRef","height","setHeight","useState","useImperativeHandle","submit","data","Promise","resolve","reject","Error","listener","addListener","args","remove","error","card","json","JSON","parse","callNativeMethod","merchantId","additionalData","showKeyboard","hideKeyboard","useCallback","methodName","params","console","log","viewId","findNodeHandle","current","commandId","Commands","toString","Platform","OS","Number","dispatchViewManagerCommand","useEffect","eventListener","width","_","frameHeight","stringify","additionalFields"],"sources":["CreditCardView.tsx"],"sourcesContent":["\nimport * as React from 'react';\nimport { requireNativeComponent, NativeModules, NativeEventEmitter, type ViewProps, Platform, findNodeHandle, UIManager, ActivityIndicator } from 'react-native';\nimport type IPEField from './IPEField';\nimport type PECard from './PECard';\nimport type ITokenizationData from './ITokenizationData';\n\nconst { RNPEEventEmitter } = NativeModules;\n\ninterface NativePECreditCardViewProps extends ViewProps {\n additionalFields: string;\n}\n\nconst COMPONENT_NAME = 'RNPECreditCardView'\nconst RNPECreditCardView = requireNativeComponent<NativePECreditCardViewProps>(COMPONENT_NAME);\n// @ts-ignore\nconst RNPECreditCardViewManager = UIManager[COMPONENT_NAME]\nconst peEventEmitter = new NativeEventEmitter(RNPEEventEmitter);\n\n/**\n * Props for the `PECreditCardView` component.\n *\n * Allows optional configuration of additional input fields that can be rendered\n * alongside the standard credit card fields.\n *\n * These fields can be used to collect extra information such as ZIP code, billing address,\n * or custom metadata required by the merchant.\n *\n * @category SecureFields\n *\n * @example\n * ```ts\n * const fields: IPEField[] = [\n * {\n * name: \"zipCode\",\n * type: \"text\",\n * placeholder: \"ZIP Code\",\n * keyboardType: PEKeyboardType.Numeric,\n * isRequired: true\n * }\n * ];\n *\n * <PECreditCardView additionalFields={fields} />\n * ```\n */\nexport interface PECreditCardViewProps {\n /**\n * (Optional) A list of additional fields to be displayed in the credit card form.\n *\n * These are rendered below the standard card number, expiry, and CVV fields.\n */\n additionalFields?: IPEField[];\n}\n\n\n/**\n * Provides methods to control and interact with the PayEngine Credit Card input view.\n *\n * This interface defines methods for submitting credit card details for tokenization\n * and managing keyboard visibility.\n *\n * @category SecureFields\n */\nexport interface PECreditCardViewMethods {\n /**\n * Submits the entered credit card information to PayEngine for tokenization.\n *\n * @param data - Optional merchant info and additional metadata.\n * @returns A promise that resolves to a tokenized credit card object (`PECard`).\n *\n * @example\n * ```ts\n * const result = await creditCardRef.current?.submit({\n * merchantId: \"merchant_123\",\n * additionalData: { source: \"checkout\" }\n * });\n * ```\n */\n submit: (data: ITokenizationData) => Promise<PECard>;\n\n /**\n * Programmatically displays the keyboard for the credit card input fields.\n */\n showKeyboard: () => void;\n\n /**\n * Programmatically hides the keyboard for the credit card input fields.\n */\n hideKeyboard: () => void;\n}\n\n/**\n * A secure form for entering a customer's credit card information safely.\n *\n * [PECreditCardView] provides an interface for users to input their credit card details securely.\n * It integrates with PayEngine to tokenize the card details and forward them to a PCI-compliant\n * third party without storing sensitive information locally.\n *\n * ## How It Works\n *\n * 1. Create an instance of [PECreditCardView], optionally passing additional fields.\n * 2. Display the form inside your UI.\n * 3. Once the user enters their details, call [submit] to securely process and retrieve a tokenized version of the card.\n * 4. Use [showKeyboard] and [hideKeyboard] to manually control the keyboard.\n *\n * ## Example Usage\n *\n * ```tsx\n * const formRef = React.createRef<PECreditCardViewMethods>();\n * \n * \n * const additionalFields = [\n * {\n * name: 'address_zip',\n * type: 'text',\n * placeholder: 'Zip code',\n * keyboardType: PEKeyboardType.alphabet,\n * isRequired: true,\n * pattern: '^(?:\\\\d{5}(?:-\\\\d{4})?|[ABCEGHJKLMNPRSTVXY]\\\\d[A-Z] ?\\\\d[A-Z]\\\\d)$'\n * }\n * ]\n *\n * return (\n * <View style={styles.container}>\n * <Text>Welcome to PayEngine React Native SDK example</Text>\n * <View style={{ width: '100%' }}>\n * <PECreditCardView ref={formRef} additionalFields={additionalFields} />\n * <Button disabled={submitting} onPress={() => createCard()} title=\"Create Card\" />\n * <Button onPress={() => formRef.current?.showKeyboard()} title=\"Show keyboard\" />\n * <Button onPress={() => formRef.current?.hideKeyboard()} title=\"Hide keyboard\" />\n * </View>\n * <ScrollView style={{ flex: 1, width: '100%', backgroundColor: 'lightyellow', padding: 10, marginVertical: 20 }}>\n * <Text>{JSON.stringify(secureFieldsResult, null, 4)}</Text>\n * </ScrollView>\n * </View>\n * );\n * ```\n *\n * ## Features:\n * - Securely collects credit card details.\n * - Supports additional customizable fields.\n * - Provides methods to show/hide the keyboard.\n * - Allows submitting the entered data for tokenization and safe storage.\n * \n * @category SecureFields\n */\nexport const PECreditCardView = React.forwardRef<\n PECreditCardViewMethods,\n PECreditCardViewProps\n>((props, ref) => {\n const formRef = React.useRef<any>();\n const [height, setHeight] = React.useState(0);\n\n React.useImperativeHandle(ref, () => ({\n submit: async (data: ITokenizationData = {}) => {\n return new Promise((resolve, reject) => {\n if (height === 0) {\n return reject(new Error('Form is not ready'))\n }\n\n const listener = peEventEmitter.addListener('onCardRespond', args => {\n listener.remove()\n\n const { error, card: json } = args;\n if (error) {\n reject(new Error(error))\n } else {\n const card = JSON.parse(json) as PECard;\n resolve(card)\n }\n });\n\n callNativeMethod(\"submit\", [data.merchantId, data.additionalData])\n });\n },\n showKeyboard: () => {\n callNativeMethod(\"showKeyboard\")\n },\n hideKeyboard: () => {\n callNativeMethod(\"hideKeyboard\")\n }\n }));\n\n const callNativeMethod = React.useCallback((methodName: string, params: any[] = []) => {\n console.log(\"callNativeMethod\", methodName, params)\n const viewId = findNodeHandle(formRef.current);\n let commandId = RNPECreditCardViewManager.Commands[methodName].toString()\n if (Platform.OS === 'ios') {\n commandId = Number(commandId)\n }\n UIManager.dispatchViewManagerCommand(\n viewId,\n commandId,\n params,\n );\n }, [formRef.current])\n\n React.useEffect(() => {\n const eventListener = peEventEmitter.addListener('onSizeChanges', args => {\n const { width: _, height: frameHeight } = args;\n setHeight(frameHeight);\n });\n\n return () => eventListener.remove();\n }, []);\n\n\n return (\n <>\n {height === 0 && <ActivityIndicator />}\n <RNPECreditCardView ref={formRef} additionalFields={JSON.stringify(props.additionalFields ?? [])} style={{ height: height }} />\n </>\n );\n});\n"],"mappings":";;;;;;;AACA;;AACA;;;;;;AAKA,MAAM;EAAEA;AAAF,IAAuBC,0BAA7B;AAMA,MAAMC,cAAc,GAAG,oBAAvB;AACA,MAAMC,kBAAkB,GAAG,IAAAC,mCAAA,EAAoDF,cAApD,CAA3B,C,CACA;;AACA,MAAMG,yBAAyB,GAAGC,sBAA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AAoC/B,IAA1C;MACAX,SAAS,CAAC0C,WAAD,CAAT;IACD,CAHqB,CAAtB;IAKA,OAAO,MAAMH,aAAa,CAAC3B,MAAd,EAAb;EACD,CAPD,EAOG,EAPH;EAUA,oBACE,0CACGb,MAAM,KAAK,CAAX,iBAAgB,oBAAC,8BAAD,OADnB,eAEE,oBAAC,kBAAD;IAAoB,GAAG,EAAEF,OAAzB;IAAkC,gBAAgB,EAAEmB,IAAI,CAAC2B,SAAL,CAAehD,KAAK,CAACiD,gBAAN,IAA0B,EAAzC,CAApD;IAAkG,KAAK,EAAE;MAAE7C,MAAM,EAAEA;IAAV;EAAzG,EAFF,CADF;AAMD,CAnE+B,CAAzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["IPEField.ts"],"sourcesContent":["import type PEKeyboardType from \"./PEKeyboardType\";\n\ninterface IPEField {\n name: string;\n type: string;\n placeholder: string;\n keyboardType: PEKeyboardType;\n isRequired: boolean;\n pattern?: string;\n}\n\nexport default IPEField;\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["IPEField.ts"],"sourcesContent":["import type PEKeyboardType from \"./PEKeyboardType\";\n\n/**\n * Represents an input field in the PayEngine system.\n *\n * The `IPEField` interface defines a form field with properties such as\n * its name, type, placeholder, keyboard type, whether it is required, and\n * an optional validation pattern.\n *\n * @category SecureFields\n *\n * @example\n * ```ts\n * const emailField: IPEField = {\n * name: \"email\",\n * type: \"text\",\n * placeholder: \"Enter your email\",\n * keyboardType: PEKeyboardType.Alphabet,\n * isRequired: true,\n * pattern: \"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\\\.[a-zA-Z]{2,}$\"\n * };\n * ```\n */\ninterface IPEField {\n /**\n * The unique identifier for the field.\n *\n * Typically used as the key when submitting form data.\n */\n name: string;\n\n /**\n * The type of the field (e.g., \"text\", \"password\", \"email\").\n *\n * Defines how the field’s value should be interpreted.\n */\n type: string;\n\n /**\n * The placeholder text shown when the field is empty.\n */\n placeholder: string;\n\n /**\n * Specifies the type of keyboard to display for this field.\n *\n * Example: `PEKeyboardType.Numeric`, `PEKeyboardType.Alphabet`\n */\n keyboardType: PEKeyboardType;\n\n /**\n * Indicates whether the field is required for form submission.\n *\n * If `true`, the field must be filled in with a valid value.\n */\n isRequired: boolean;\n\n /**\n * Optional regular expression used to validate the field's value.\n *\n * If omitted, no validation is enforced.\n */\n pattern?: string;\n}\n\n\nexport default IPEField;\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["ITokenizationData.ts"],"sourcesContent":["interface ITokenizationData {\n merchantId?: string;\n additionalData?: {
|
|
1
|
+
{"version":3,"names":[],"sources":["ITokenizationData.ts"],"sourcesContent":["/**\n * Represents the data used for tokenizing a credit card or bank account.\n *\n * This interface allows passing additional metadata or specifying the merchant\n * for whom the data is being tokenized.\n *\n * @category SecureFields\n */\ninterface ITokenizationData {\n /**\n * (Optional) The merchant ID on behalf of whom the tokenization is performed.\n */\n merchantId?: string;\n\n /**\n * (Optional) A key-value map of additional metadata to include in the request.\n */\n additionalData?: {\n [key: string]: string;\n };\n}\n\nexport default ITokenizationData;\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["PEBankAccount.ts"],"sourcesContent":["interface PEBankAccount {\n id: string;\n token: string;\n account_data: {\n first_name: string;\n last_name: string;\n routing_number: string;\n last_4: string;\n };\n}\n\nexport default PEBankAccount;"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["PEBankAccount.ts"],"sourcesContent":["/**\n * Represents a bank account stored within PayEngine.\n *\n * This interface contains a secure token and account details, ensuring sensitive banking\n * information is securely managed within the system.\n *\n * @category SecureFields\n */\ninterface PEBankAccount {\n /**\n * A unique identifier for the bank account.\n *\n * This may be used internally to reference the bank account object.\n */\n id: string;\n\n /**\n * A secure token representing the bank account.\n *\n * This token is used for referencing the account in API operations without exposing raw bank details.\n */\n token: string;\n\n /**\n * The associated bank account details.\n *\n * Includes essential information such as the account holder's name,\n * the routing number, and the last four digits of the account number.\n */\n account_data: {\n /**\n * The first name of the account holder.\n */\n first_name: string;\n\n /**\n * The last name of the account holder.\n */\n last_name: string;\n\n /**\n * The bank's routing number.\n */\n routing_number: string;\n\n /**\n * The last four digits of the bank account number.\n */\n last_4: string;\n };\n}\n\n\nexport default PEBankAccount;"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["PECard.ts"],"sourcesContent":["interface PECard {\n token: string;\n card_data: {\n id: string;\n brand: string;\n last_4: string;\n exp_year: string;\n exp_month: string;\n name: string;\n address_zip?: string;\n };\n}\n\nexport default PECard;"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["PECard.ts"],"sourcesContent":["/**\n * Represents a payment card stored with PayEngine.\n *\n * This interface contains a secure token and associated card details,\n * ensuring sensitive payment information is securely managed within the system.\n *\n * @category SecureFields\n */\ninterface PECard {\n /**\n * A secure token representing the card.\n *\n * This token is used to safely reference the card in API operations without exposing raw card data.\n */\n token: string;\n\n /**\n * The associated card details.\n *\n * Includes essential information such as brand, expiration date,\n * the last four digits, cardholder name, and optional billing ZIP code.\n */\n card_data: {\n /**\n * A unique identifier for the card.\n *\n * This ID is typically used to reference the card object in system operations.\n */\n id: string;\n\n /**\n * The brand of the card (e.g., Visa, MasterCard).\n */\n brand: string;\n\n /**\n * The last four digits of the card number.\n *\n * Useful for displaying or confirming the card to the user.\n */\n last_4: string;\n\n /**\n * The expiration year of the card.\n */\n exp_year: string;\n\n /**\n * The expiration month of the card.\n */\n exp_month: string;\n\n /**\n * The name of the cardholder.\n */\n name: string;\n\n /**\n * The ZIP code associated with the card's billing address (optional).\n */\n address_zip?: string;\n };\n}\n\n\nexport default PECard;"],"mappings":""}
|
|
@@ -3,15 +3,32 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
6
|
+
exports.default = exports.PEKeyboardType = void 0;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Defines the keyboard type for a PayEngine secure input field.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* This enum is used in {@link IPEField.keyboardType} to control the keyboard layout
|
|
13
|
+
* shown to the user based on the input field's context.
|
|
14
|
+
*
|
|
15
|
+
* The available keyboard types are:
|
|
16
|
+
* - {@link PEKeyboardType.alphabet} — Optimized for alphabetic characters.
|
|
17
|
+
* - {@link PEKeyboardType.number} — Optimized for numeric input.
|
|
18
|
+
* - {@link PEKeyboardType.phone} — Designed for entering phone numbers.
|
|
19
|
+
* - {@link PEKeyboardType.normal} — Standard keyboard with alphanumeric characters.
|
|
20
|
+
*
|
|
21
|
+
* @category SecureFields
|
|
22
|
+
*/
|
|
23
|
+
let PEKeyboardType;
|
|
24
|
+
exports.PEKeyboardType = PEKeyboardType;
|
|
8
25
|
|
|
9
26
|
(function (PEKeyboardType) {
|
|
10
27
|
PEKeyboardType["alphabet"] = "alphabet";
|
|
11
28
|
PEKeyboardType["number"] = "number";
|
|
12
29
|
PEKeyboardType["phone"] = "phone";
|
|
13
30
|
PEKeyboardType["normal"] = "normal";
|
|
14
|
-
})(PEKeyboardType || (PEKeyboardType = {}));
|
|
31
|
+
})(PEKeyboardType || (exports.PEKeyboardType = PEKeyboardType = {}));
|
|
15
32
|
|
|
16
33
|
var _default = PEKeyboardType;
|
|
17
34
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PEKeyboardType"],"sources":["PEKeyboardType.ts"],"sourcesContent":["enum PEKeyboardType {\n alphabet = 'alphabet',\n number = 'number',\n phone = 'phone',\n normal = 'normal',\n}\n\nexport default PEKeyboardType;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["PEKeyboardType"],"sources":["PEKeyboardType.ts"],"sourcesContent":["import type IPEField from './IPEField';\n\n/**\n * Defines the keyboard type for a PayEngine secure input field.\n *\n * @remarks\n * This enum is used in {@link IPEField.keyboardType} to control the keyboard layout\n * shown to the user based on the input field's context.\n *\n * The available keyboard types are:\n * - {@link PEKeyboardType.alphabet} — Optimized for alphabetic characters.\n * - {@link PEKeyboardType.number} — Optimized for numeric input.\n * - {@link PEKeyboardType.phone} — Designed for entering phone numbers.\n * - {@link PEKeyboardType.normal} — Standard keyboard with alphanumeric characters.\n *\n * @category SecureFields\n */\nexport enum PEKeyboardType {\n alphabet = 'alphabet',\n number = 'number',\n phone = 'phone',\n normal = 'normal',\n}\n\nexport default PEKeyboardType;\n"],"mappings":";;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACYA,c;;;WAAAA,c;EAAAA,c;EAAAA,c;EAAAA,c;EAAAA,c;GAAAA,c,8BAAAA,c;;eAOGA,c"}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -8,44 +8,44 @@ var _exportNames = {
|
|
|
8
8
|
PayEngine: true,
|
|
9
9
|
PayProvider: true,
|
|
10
10
|
PECreditCardView: true,
|
|
11
|
-
PECreditCardViewMethods: true,
|
|
12
11
|
PEBankAccountView: true,
|
|
13
|
-
PEBankAccountViewMethods: true,
|
|
14
12
|
PayEngineProvider: true,
|
|
15
13
|
PayEngineNative: true,
|
|
14
|
+
FetchAccessTokenCallback: true,
|
|
15
|
+
AccessToken: true,
|
|
16
16
|
PEApplePayButton: true,
|
|
17
17
|
PEGooglePayButton: true,
|
|
18
18
|
PayEngineUtils: true,
|
|
19
19
|
PEKeyboardType: true
|
|
20
20
|
};
|
|
21
|
-
Object.defineProperty(exports, "
|
|
21
|
+
Object.defineProperty(exports, "AccessToken", {
|
|
22
22
|
enumerable: true,
|
|
23
23
|
get: function () {
|
|
24
|
-
return
|
|
24
|
+
return _PayEngineNative.AccessToken;
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
-
Object.defineProperty(exports, "
|
|
27
|
+
Object.defineProperty(exports, "FetchAccessTokenCallback", {
|
|
28
28
|
enumerable: true,
|
|
29
29
|
get: function () {
|
|
30
|
-
return
|
|
30
|
+
return _PayEngineNative.FetchAccessTokenCallback;
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
|
-
Object.defineProperty(exports, "
|
|
33
|
+
Object.defineProperty(exports, "PEApplePayButton", {
|
|
34
34
|
enumerable: true,
|
|
35
35
|
get: function () {
|
|
36
|
-
return
|
|
36
|
+
return _PEApplePayButton.PEApplePayButton;
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
|
-
Object.defineProperty(exports, "
|
|
39
|
+
Object.defineProperty(exports, "PEBankAccountView", {
|
|
40
40
|
enumerable: true,
|
|
41
41
|
get: function () {
|
|
42
|
-
return
|
|
42
|
+
return _BankAccountView.PEBankAccountView;
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
|
-
Object.defineProperty(exports, "
|
|
45
|
+
Object.defineProperty(exports, "PECreditCardView", {
|
|
46
46
|
enumerable: true,
|
|
47
47
|
get: function () {
|
|
48
|
-
return _CreditCardView.
|
|
48
|
+
return _CreditCardView.PECreditCardView;
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
Object.defineProperty(exports, "PEGooglePayButton", {
|
|
@@ -98,7 +98,7 @@ var _BankAccountView = require("./components/v2/SecureFields/BankAccountView");
|
|
|
98
98
|
|
|
99
99
|
var _PayEngineProvider = require("./components/v2/PayEngineProvider");
|
|
100
100
|
|
|
101
|
-
var _PayEngineNative =
|
|
101
|
+
var _PayEngineNative = _interopRequireWildcard(require("./components/v2/PayEngineNative"));
|
|
102
102
|
|
|
103
103
|
var _PEApplePayButton = require("./components/v2/ApplePay/PEApplePayButton");
|
|
104
104
|
|
|
@@ -144,6 +144,10 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
144
144
|
|
|
145
145
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
146
146
|
|
|
147
|
+
/**
|
|
148
|
+
* Main Module
|
|
149
|
+
* @module PayEngine SDK
|
|
150
|
+
*/
|
|
147
151
|
const LINKING_ERROR = `The package 'react-native-payengine' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
148
152
|
ios: "- You have run 'pod install'\n",
|
|
149
153
|
default: ''
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","PayEngineStatic","NativeModules","Payengine","Proxy","get","Error"],"sources":["index.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","PayEngineStatic","NativeModules","Payengine","Proxy","get","Error"],"sources":["index.tsx"],"sourcesContent":["/**\n * Main Module\n * @module PayEngine SDK\n */\n\nimport PayEngine from './components/PayEngine';\nimport { NativeModules, Platform } from 'react-native';\nimport type { IPayEngineConfig } from './interfaces/index';\nimport { PayProvider } from './interfaces/index';\nimport type ITokenizationData from './components/v2/SecureFields/ITokenizationData'\nimport {\n PECreditCardView,\n type PECreditCardViewProps,\n type PECreditCardViewMethods,\n} from './components/v2/SecureFields/CreditCardView';\nimport {\n PEBankAccountView,\n type PEBankAccountViewProps,\n type PEBankAccountViewMethods,\n} from './components/v2/SecureFields/BankAccountView';\nimport type IPEField from './components/v2/SecureFields/IPEField';\nimport type PECard from './components/v2/SecureFields/PECard';\nimport type PEBankAccount from './components/v2/SecureFields/PEBankAccount';\nimport { PayEngineProvider } from './components/v2/PayEngineProvider';\nimport PayEngineNative from './components/v2/PayEngineNative';\nimport { FetchAccessTokenCallback, AccessToken } from './components/v2/PayEngineNative';\nimport { PEApplePayButton, type PEApplePayButtonProps, type PEApplePayButtonMethods } from './components/v2/ApplePay/PEApplePayButton';\n\nimport { PEGooglePayButton, type PEGooglePayButtonProps, type PEGooglePayButtonMethods } from './components/v2/GooglePay/PEGooglePayButton';\nimport * as PayEngineUtils from './utils/index';\nimport PEKeyboardType from './components/v2/SecureFields/PEKeyboardType';\nimport type { PEGooglePayAddress } from './components/v2/GooglePay/PEGooglePayAddress';\nimport type { PEApplePayContact } from './components/v2/ApplePay/PEApplePayInterfaces';\n\nexport * from './components/v2/PEPaymentRequest';\nexport * from './components/v2/ApplePay/PEApplePayInterfaces';\n\n\nconst LINKING_ERROR =\n `The package 'react-native-payengine' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst PayEngineStatic = NativeModules.Payengine\n ? NativeModules.Payengine\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport {\n PayEngineStatic,\n PayEngine,\n IPayEngineConfig,\n PayProvider,\n // v2 starting here\n PayEngineUtils,\n PayEngineProvider,\n PayEngineNative,\n AccessToken,\n FetchAccessTokenCallback,\n // securefields\n PEKeyboardType,\n IPEField,\n ITokenizationData,\n // credit card\n PECreditCardView,\n PECreditCardViewProps,\n PECreditCardViewMethods,\n PECard,\n // bank account\n PEBankAccountView,\n PEBankAccountViewProps,\n PEBankAccountViewMethods,\n PEBankAccount,\n // Apple Pay\n PEApplePayButton,\n PEApplePayButtonProps,\n PEApplePayButtonMethods,\n // RNPEApplePayOptions,\n // RNPEContactField,\n PEApplePayContact,\n // RNPEGooglePayBillingAddressParameters,\n // RNPEGooglePayShippingAddressParameters,\n // PEPaymentRequest,\n PEGooglePayButton,\n PEGooglePayAddress,\n PEGooglePayButtonProps,\n PEGooglePayButtonMethods\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA;;AACA;;AAEA;;AAEA;;AAKA;;AAQA;;AACA;;AAEA;;AAEA;;AACA;;;;AACA;;AAIA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;;;;;;;AAnCA;AACA;AACA;AACA;AAmCA,MAAMA,aAAa,GAChB,iFAAD,GACAC,qBAAA,CAASC,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,eAAe,GAAGC,0BAAA,CAAcC,SAAd,GACpBD,0BAAA,CAAcC,SADM,GAEpB,IAAIC,KAAJ,CACE,EADF,EAEE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUV,aAAV,CAAN;EACD;;AAHH,CAFF,CAFJ"}
|
|
@@ -4,6 +4,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.PayProvider = void 0;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents the configuration settings for PayEngine.
|
|
10
|
+
*
|
|
11
|
+
* The [IPayEngineConfig] interface holds essential details such as the public key,
|
|
12
|
+
* script version, and logging level. It is used to configure the PayEngine integration
|
|
13
|
+
* for API interactions.
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Enum representing supported payment providers.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* This enum specifies the available payment providers supported by the PayEngine SDK.
|
|
22
|
+
* It is used to check which payment method (Apple Pay or Google Pay) is available for use.
|
|
23
|
+
*
|
|
24
|
+
* @enum {string}
|
|
25
|
+
* @category PayEngine
|
|
26
|
+
*/
|
|
7
27
|
let PayProvider;
|
|
8
28
|
exports.PayProvider = PayProvider;
|
|
9
29
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PayProvider"],"sources":["index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"names":["PayProvider"],"sources":["index.ts"],"sourcesContent":["/**\n * Represents the configuration settings for PayEngine.\n *\n * The [IPayEngineConfig] interface holds essential details such as the public key,\n * script version, and logging level. It is used to configure the PayEngine integration\n * for API interactions.\n *\n */\nexport interface IPayEngineConfig {\n /**\n * The public key associated with the PayEngine account.\n * This key is required for authentication when making API requests.\n */\n publicKey: string;\n\n /**\n * The version of the PayEngine integration.\n * If provided, this specifies the version of the script or API being used.\n */\n version?: string;\n\n /**\n * The script URL for loading the PayEngine JavaScript library.\n * If provided, this URL is used instead of the default script URL.\n */\n scriptURL?: string;\n\n /**\n * The log level for debugging.\n * Higher values enable more detailed logging.\n */\n logLevel?: number;\n}\n\n\n/**\n * Enum representing supported payment providers.\n *\n * @remarks\n * This enum specifies the available payment providers supported by the PayEngine SDK.\n * It is used to check which payment method (Apple Pay or Google Pay) is available for use.\n *\n * @enum {string}\n * @category PayEngine\n */\nexport enum PayProvider {\n googlePay, // Google Pay payment provider.\n applePay // Apple Pay payment provider.\n}"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA4BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACYA,W;;;WAAAA,W;EAAAA,W,CAAAA,W;EAAAA,W,CAAAA,W;GAAAA,W,2BAAAA,W"}
|
|
@@ -10,12 +10,22 @@ var _axios = _interopRequireDefault(require("axios"));
|
|
|
10
10
|
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Custom error thrown when an obsolete method is called.
|
|
15
|
+
*
|
|
16
|
+
* The `PEDeprecationError` indicates that the method being used is deprecated,
|
|
17
|
+
* and the user should check the package README for updated usage.
|
|
18
|
+
*/
|
|
13
19
|
class PEDeprecationError extends Error {
|
|
14
20
|
constructor() {
|
|
15
21
|
super('This method is obsolete and can not be used anymore. Please check out the package README');
|
|
16
22
|
}
|
|
17
23
|
|
|
18
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* @private
|
|
27
|
+
*/
|
|
28
|
+
|
|
19
29
|
|
|
20
30
|
exports.PEDeprecationError = PEDeprecationError;
|
|
21
31
|
|
|
@@ -24,6 +34,10 @@ const getHttpHeaders = config => {
|
|
|
24
34
|
Authorization: `Signature key="${config.publicKey}",algorithm="hmac-sha256",identifier="secure-fields",signature=""`
|
|
25
35
|
};
|
|
26
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* @private
|
|
39
|
+
*/
|
|
40
|
+
|
|
27
41
|
|
|
28
42
|
exports.getHttpHeaders = getHttpHeaders;
|
|
29
43
|
|
|
@@ -36,6 +50,10 @@ const getBaseURL = config => {
|
|
|
36
50
|
|
|
37
51
|
return baseUrl;
|
|
38
52
|
};
|
|
53
|
+
/**
|
|
54
|
+
* @private
|
|
55
|
+
*/
|
|
56
|
+
|
|
39
57
|
|
|
40
58
|
exports.getBaseURL = getBaseURL;
|
|
41
59
|
|
|
@@ -45,6 +63,10 @@ const createHttpClient = config => {
|
|
|
45
63
|
headers: getHttpHeaders(config)
|
|
46
64
|
});
|
|
47
65
|
};
|
|
66
|
+
/**
|
|
67
|
+
* @private
|
|
68
|
+
*/
|
|
69
|
+
|
|
48
70
|
|
|
49
71
|
exports.createHttpClient = createHttpClient;
|
|
50
72
|
|
|
@@ -66,6 +88,10 @@ function getScriptURL(config) {
|
|
|
66
88
|
|
|
67
89
|
return scriptURL;
|
|
68
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* @private
|
|
93
|
+
*/
|
|
94
|
+
|
|
69
95
|
|
|
70
96
|
const debuggingScript = `
|
|
71
97
|
const consoleLog = (type, ...log) => window.ReactNativeWebView.postMessage(JSON.stringify({'type': 'Console', 'data': {'type': type, 'log': log}}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PEDeprecationError","Error","constructor","getHttpHeaders","config","Authorization","publicKey","getBaseURL","baseUrl","includes","scriptURL","replace","createHttpClient","axios","create","baseURL","headers","getScriptURL","logLevelStr","logLevel","version","debuggingScript"],"sources":["index.ts"],"sourcesContent":["import axios from 'axios';\nimport type { IPayEngineConfig } from '../interfaces/index';\n\nexport class PEDeprecationError extends Error {\n constructor() {\n super(\n 'This method is obsolete and can not be used anymore. Please check out the package README'\n );\n }\n}\n\nexport const getHttpHeaders = (config: IPayEngineConfig) => {\n return {\n Authorization: `Signature key=\"${config.publicKey}\",algorithm=\"hmac-sha256\",identifier=\"secure-fields\",signature=\"\"`,\n };\n};\n\nexport const getBaseURL = (config: IPayEngineConfig) => {\n let baseUrl = config.publicKey.includes('_prod_')\n ? 'https://console.payengine.co'\n : 'https://console.payengine.dev';\n\n if (config.scriptURL) {\n baseUrl = config.scriptURL.replace(/^((\\w+:)?\\/\\/[^\\/]+\\/?).*$/, '$1');\n }\n return baseUrl;\n};\n\nexport const createHttpClient = (config: IPayEngineConfig) => {\n return axios.create({\n baseURL: getBaseURL(config),\n headers: getHttpHeaders(config),\n });\n};\n\nexport function getScriptURL(config: IPayEngineConfig) {\n if (!config.publicKey) {\n throw new Error('PayEngine Public Key is missing');\n }\n let scriptURL = '';\n const logLevelStr = config.logLevel ? `&loglevel=${config.logLevel}` : '';\n if (config.scriptURL) {\n scriptURL = `${config.scriptURL}?key=${config.publicKey}${logLevelStr}`;\n } else {\n const baseURL = config.publicKey.includes('_prod_')\n ? 'https://console.payengine.co'\n : 'https://console.payengine.dev';\n const version = config.version ?? '1.0.0';\n scriptURL = `${baseURL}/js/${version}/embed.js?key=${config.publicKey}${logLevelStr}`;\n }\n\n return scriptURL;\n}\n\nexport const debuggingScript = `\nconst consoleLog = (type, ...log) => window.ReactNativeWebView.postMessage(JSON.stringify({'type': 'Console', 'data': {'type': type, 'log': log}}));\nconsole = {\n log: (...log) => consoleLog('log', ...log),\n debug: (...log) => consoleLog('debug', ...log),\n info: (...log) => consoleLog('info', ...log),\n warn: (...log) => consoleLog('warn', ...log),\n error: (...log) => consoleLog('error', ...log),\n verbose: (...log) => consoleLog('verbose', ...log),\n};\n\nconst dispatchEvent_original = EventTarget.prototype.dispatchEvent;\nfunction dispatchEvent(event) {\n if (event.type && !event.type.startsWith('react')) {\n ReactNativeWebView.postMessage(JSON.stringify({\n type: 'PayEngine',\n event: {\n type: event.type,\n detail: event.detail\n }\n }))\n }\n}\nEventTarget.prototype.dispatchEvent = dispatchEvent;\n`;\n"],"mappings":";;;;;;;;AAAA;;;;
|
|
1
|
+
{"version":3,"names":["PEDeprecationError","Error","constructor","getHttpHeaders","config","Authorization","publicKey","getBaseURL","baseUrl","includes","scriptURL","replace","createHttpClient","axios","create","baseURL","headers","getScriptURL","logLevelStr","logLevel","version","debuggingScript"],"sources":["index.ts"],"sourcesContent":["import axios from 'axios';\nimport type { IPayEngineConfig } from '../interfaces/index';\n\n/**\n * Custom error thrown when an obsolete method is called.\n *\n * The `PEDeprecationError` indicates that the method being used is deprecated,\n * and the user should check the package README for updated usage.\n */\nexport class PEDeprecationError extends Error {\n constructor() {\n super(\n 'This method is obsolete and can not be used anymore. Please check out the package README'\n );\n }\n}\n\n/**\n * @private\n */\nexport const getHttpHeaders = (config: IPayEngineConfig) => {\n return {\n Authorization: `Signature key=\"${config.publicKey}\",algorithm=\"hmac-sha256\",identifier=\"secure-fields\",signature=\"\"`,\n };\n};\n\n/**\n * @private\n */\nexport const getBaseURL = (config: IPayEngineConfig) => {\n let baseUrl = config.publicKey.includes('_prod_')\n ? 'https://console.payengine.co'\n : 'https://console.payengine.dev';\n\n if (config.scriptURL) {\n baseUrl = config.scriptURL.replace(/^((\\w+:)?\\/\\/[^\\/]+\\/?).*$/, '$1');\n }\n return baseUrl;\n};\n\n/**\n * @private\n */\nexport const createHttpClient = (config: IPayEngineConfig) => {\n return axios.create({\n baseURL: getBaseURL(config),\n headers: getHttpHeaders(config),\n });\n};\n\n/**\n * @private\n */\nexport function getScriptURL(config: IPayEngineConfig) {\n if (!config.publicKey) {\n throw new Error('PayEngine Public Key is missing');\n }\n let scriptURL = '';\n const logLevelStr = config.logLevel ? `&loglevel=${config.logLevel}` : '';\n if (config.scriptURL) {\n scriptURL = `${config.scriptURL}?key=${config.publicKey}${logLevelStr}`;\n } else {\n const baseURL = config.publicKey.includes('_prod_')\n ? 'https://console.payengine.co'\n : 'https://console.payengine.dev';\n const version = config.version ?? '1.0.0';\n scriptURL = `${baseURL}/js/${version}/embed.js?key=${config.publicKey}${logLevelStr}`;\n }\n\n return scriptURL;\n}\n\n/**\n * @private\n */\nexport const debuggingScript = `\nconst consoleLog = (type, ...log) => window.ReactNativeWebView.postMessage(JSON.stringify({'type': 'Console', 'data': {'type': type, 'log': log}}));\nconsole = {\n log: (...log) => consoleLog('log', ...log),\n debug: (...log) => consoleLog('debug', ...log),\n info: (...log) => consoleLog('info', ...log),\n warn: (...log) => consoleLog('warn', ...log),\n error: (...log) => consoleLog('error', ...log),\n verbose: (...log) => consoleLog('verbose', ...log),\n};\n\nconst dispatchEvent_original = EventTarget.prototype.dispatchEvent;\nfunction dispatchEvent(event) {\n if (event.type && !event.type.startsWith('react')) {\n ReactNativeWebView.postMessage(JSON.stringify({\n type: 'PayEngine',\n event: {\n type: event.type,\n detail: event.detail\n }\n }))\n }\n}\nEventTarget.prototype.dispatchEvent = dispatchEvent;\n`;\n"],"mappings":";;;;;;;;AAAA;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,kBAAN,SAAiCC,KAAjC,CAAuC;EAC5CC,WAAW,GAAG;IACZ,MACE,0FADF;EAGD;;AAL2C;AAQ9C;AACA;AACA;;;;;AACO,MAAMC,cAAc,GAAIC,MAAD,IAA8B;EAC1D,OAAO;IACLC,aAAa,EAAG,kBAAiBD,MAAM,CAACE,SAAU;EAD7C,CAAP;AAGD,CAJM;AAMP;AACA;AACA;;;;;AACO,MAAMC,UAAU,GAAIH,MAAD,IAA8B;EACtD,IAAII,OAAO,GAAGJ,MAAM,CAACE,SAAP,CAAiBG,QAAjB,CAA0B,QAA1B,IACV,8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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAxBO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Text","PayEngine"],"sources":["PayEngine.tsx"],"sourcesContent":["import React from 'react';\nimport { Text } from 'react-native';\n\nconst PayEngine = () => {\n return <Text>Obsolete. Please check out the package readme</Text>;\n};\n\nexport default PayEngine;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,IAAT,QAAqB,cAArB;;AAEA,MAAMC,SAAS,
|
|
1
|
+
{"version":3,"names":["React","Text","PayEngine","_props"],"sources":["PayEngine.tsx"],"sourcesContent":["import React from 'react';\nimport { Text } from 'react-native';\n\nconst PayEngine = (_props: any) => {\n return <Text>Obsolete. Please check out the package readme</Text>;\n};\n\nexport default PayEngine;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,IAAT,QAAqB,cAArB;;AAEA,MAAMC,SAAS,GAAIC,MAAD,IAAiB;EACjC,oBAAO,oBAAC,IAAD,wDAAP;AACD,CAFD;;AAIA,eAAeD,SAAf"}
|
|
@@ -8,6 +8,130 @@ const COMPONENT_NAME = 'RNPEApplePayButton';
|
|
|
8
8
|
const RNPEApplePayButton = requireNativeComponent(COMPONENT_NAME); // @ts-ignore
|
|
9
9
|
|
|
10
10
|
const RNPEApplePayButtonManager = UIManager[COMPONENT_NAME];
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A React component for initiating an Apple Pay transaction.
|
|
14
|
+
*
|
|
15
|
+
* This button wraps the Apple Pay experience, including presenting the Apple Pay sheet,
|
|
16
|
+
* handling user interactions, processing the payment, and managing callbacks such as
|
|
17
|
+
* payment success, failure, and contact/method selection.
|
|
18
|
+
*
|
|
19
|
+
* It exposes imperative methods via `ref` to allow control over the Apple Pay sheet,
|
|
20
|
+
* such as updating summary items or shipping options in response to user input.
|
|
21
|
+
*
|
|
22
|
+
* ## Example Usage:
|
|
23
|
+
*
|
|
24
|
+
* ```tsx
|
|
25
|
+
* const paymentRequest = {
|
|
26
|
+
* merchantId: "merchant.com.example",
|
|
27
|
+
* countryCode: "US",
|
|
28
|
+
* currencyCode: "USD",
|
|
29
|
+
* paymentAmount: 10.00,
|
|
30
|
+
* paymentSummaryItems: [
|
|
31
|
+
* { label: "Test Item", amount: "10.00" }
|
|
32
|
+
* ],
|
|
33
|
+
* requiredShippingContactFields: ["name", "postalAddress"]
|
|
34
|
+
* };
|
|
35
|
+
*
|
|
36
|
+
* <PEApplePayButton
|
|
37
|
+
* paymentRequest={paymentRequest}
|
|
38
|
+
*
|
|
39
|
+
* // Triggered when payment fails
|
|
40
|
+
* onPaymentFailed={(error) => console.error("Payment failed:", error)}
|
|
41
|
+
*
|
|
42
|
+
* // Triggered when Apple Pay sheet is dismissed by the user
|
|
43
|
+
* onPaymentSheetDismissed={() => console.log("Payment sheet dismissed")}
|
|
44
|
+
*
|
|
45
|
+
* // Triggered when a valid token is generated after successful Apple Pay authorization
|
|
46
|
+
* onTokenDidReturn={(token, metadata, billingContact, shippingContact) => {
|
|
47
|
+
* console.log('Apple Pay token:', token, metadata, billingContact, shippingContact);
|
|
48
|
+
* // TODO: Send token to your server for processing
|
|
49
|
+
* purchaseWithToken(token);
|
|
50
|
+
* }}
|
|
51
|
+
*
|
|
52
|
+
* // Triggered when user selects or updates their shipping contact info
|
|
53
|
+
* onShippingContactSelected={(event) => {
|
|
54
|
+
* console.log('onShippingContactSelected', event.nativeEvent);
|
|
55
|
+
*
|
|
56
|
+
* if (!event.nativeEvent.contact.postalCode) {
|
|
57
|
+
* // Invalid postal code — update Apple Pay sheet with an error
|
|
58
|
+
* buttonRef?.current?.updatePaymentSheet([], [], [{
|
|
59
|
+
* errorType: PEApplePaySheetErrorType.InvalidShippingAddress,
|
|
60
|
+
* field: PEApplePayInvalidShippingField.PostalCode,
|
|
61
|
+
* message: 'Please update postal code to continue'
|
|
62
|
+
* }]);
|
|
63
|
+
* } else {
|
|
64
|
+
* // Provide updated shipping methods if contact is valid
|
|
65
|
+
* buttonRef?.current?.updatePaymentSheet([], [
|
|
66
|
+
* {
|
|
67
|
+
* identifier: 'new-shipping1',
|
|
68
|
+
* label: 'Updated shipping 1',
|
|
69
|
+
* amount: 3.99
|
|
70
|
+
* },
|
|
71
|
+
* {
|
|
72
|
+
* identifier: 'new-shipping2',
|
|
73
|
+
* label: 'Updated shipping 2',
|
|
74
|
+
* amount: 5.99
|
|
75
|
+
* }
|
|
76
|
+
* ], []);
|
|
77
|
+
* }
|
|
78
|
+
* }}
|
|
79
|
+
*
|
|
80
|
+
* // Triggered when user selects a shipping method
|
|
81
|
+
* onShippingMethodSelected={(event) => {
|
|
82
|
+
* console.log('onShippingMethodSelected', event.nativeEvent);
|
|
83
|
+
*
|
|
84
|
+
* const shippingFee = event.nativeEvent.shippingMethod.amount;
|
|
85
|
+
* const items = [
|
|
86
|
+
* {
|
|
87
|
+
* label: 'Product price',
|
|
88
|
+
* amount: paymentRequest.paymentAmount
|
|
89
|
+
* },
|
|
90
|
+
* ...(shippingFee > 0 ? [{
|
|
91
|
+
* label: 'Shipping Fee',
|
|
92
|
+
* amount: shippingFee
|
|
93
|
+
* }] : []),
|
|
94
|
+
* {
|
|
95
|
+
* label: 'Total',
|
|
96
|
+
* amount: paymentRequest.paymentAmount + shippingFee
|
|
97
|
+
* }
|
|
98
|
+
* ];
|
|
99
|
+
*
|
|
100
|
+
* buttonRef?.current?.updatePaymentSheet(items, [], []);
|
|
101
|
+
* }}
|
|
102
|
+
*
|
|
103
|
+
* // Triggered when user selects a payment method (e.g., credit, debit)
|
|
104
|
+
* onPaymentMethodSelected={(event) => {
|
|
105
|
+
* console.log('onPaymentMethodSelected', event.nativeEvent);
|
|
106
|
+
*
|
|
107
|
+
* const isCredit = event.nativeEvent.paymentMethod.type === PEApplePayPaymentMethodType.credit;
|
|
108
|
+
* const items = [
|
|
109
|
+
* {
|
|
110
|
+
* label: 'Product price',
|
|
111
|
+
* amount: paymentRequest.paymentAmount
|
|
112
|
+
* },
|
|
113
|
+
* ...(isCredit ? [{
|
|
114
|
+
* label: 'Credit discount',
|
|
115
|
+
* amount: 10
|
|
116
|
+
* }] : []),
|
|
117
|
+
* {
|
|
118
|
+
* label: 'Total',
|
|
119
|
+
* amount: paymentRequest.paymentAmount - (isCredit ? 1.00 : 0.00)
|
|
120
|
+
* }
|
|
121
|
+
* ];
|
|
122
|
+
*
|
|
123
|
+
* buttonRef?.current?.updatePaymentSheet(items, [], []);
|
|
124
|
+
* }}
|
|
125
|
+
*
|
|
126
|
+
* ref={applePayRef}
|
|
127
|
+
* />
|
|
128
|
+
* ```
|
|
129
|
+
*
|
|
130
|
+
* @param props - The props for configuring the Apple Pay button behavior.
|
|
131
|
+
* @param ref - A ref to access Apple Pay sheet update methods imperatively.
|
|
132
|
+
*
|
|
133
|
+
* @category Apple Pay
|
|
134
|
+
*/
|
|
11
135
|
export const PEApplePayButton = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
12
136
|
const buttonRef = React.useRef();
|
|
13
137
|
React.useImperativeHandle(ref, () => ({
|