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.
Files changed (155) hide show
  1. package/README.md +96 -65
  2. package/android/.gradle/checksums/checksums.lock +0 -0
  3. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  4. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  5. package/android/build.gradle +2 -2
  6. package/android/src/main/java/com/reactnativepayengine/v2/RNPayEngineNative.kt +65 -3
  7. package/android/src/main/java/com/reactnativepayengine/v2/securefields/RNPEEvents.kt +1 -0
  8. package/android/src/main/java/com/reactnativepayengine/v2/securefields/bankaccount/RNBankAccountViewManager.kt +16 -3
  9. package/android/src/main/java/com/reactnativepayengine/v2/securefields/creditcard/RNPECreditCardViewManager.kt +15 -4
  10. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/KDataCollector.h +4 -25
  11. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/KountAnalyticsViewController.h +0 -20
  12. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/KountPrivate.h +61 -0
  13. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/PayEngineSDK-Swift.h +430 -133
  14. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Info.plist +0 -0
  15. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.abi.json +1848 -5121
  16. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +35 -117
  17. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.private.swiftinterface-e +35 -117
  18. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  19. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftinterface +35 -117
  20. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftinterface-e +35 -117
  21. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/PayEngineSDK +0 -0
  22. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/VGSCollectSDK_VGSCollectSDK.bundle/Info.plist +0 -0
  23. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/KDataCollector.h +4 -25
  24. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/KountAnalyticsViewController.h +0 -20
  25. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/KountPrivate.h +61 -0
  26. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/PayEngineSDK-Swift.h +860 -266
  27. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Info.plist +0 -0
  28. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +1848 -5121
  29. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +35 -117
  30. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface-e +35 -117
  31. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  32. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +35 -117
  33. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface-e +35 -117
  34. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +1848 -5121
  35. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +35 -117
  36. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface-e +35 -117
  37. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  38. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +35 -117
  39. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface-e +35 -117
  40. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/PayEngineSDK +0 -0
  41. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/VGSCollectSDK_VGSCollectSDK.bundle/Info.plist +0 -0
  42. package/ios/Sources/Classes/RNPEEventEmitter.swift +1 -1
  43. package/ios/Sources/Classes/RNPayEngineNative.swift +125 -64
  44. package/ios/Sources/Classes/SecureFields/RNPEEvents.swift +1 -0
  45. package/ios/Sources/Payengine.m +6 -0
  46. package/lib/commonjs/components/PayEngine.js +1 -1
  47. package/lib/commonjs/components/PayEngine.js.map +1 -1
  48. package/lib/commonjs/components/v2/ApplePay/PEApplePayButton.js +124 -0
  49. package/lib/commonjs/components/v2/ApplePay/PEApplePayButton.js.map +1 -1
  50. package/lib/commonjs/components/v2/ApplePay/PEApplePayInterfaces.js +78 -0
  51. package/lib/commonjs/components/v2/ApplePay/PEApplePayInterfaces.js.map +1 -1
  52. package/lib/commonjs/components/v2/GooglePay/PEGooglePayAddress.js.map +1 -1
  53. package/lib/commonjs/components/v2/GooglePay/PEGooglePayButton.js +53 -0
  54. package/lib/commonjs/components/v2/GooglePay/PEGooglePayButton.js.map +1 -1
  55. package/lib/commonjs/components/v2/PEPaymentRequest.js +121 -0
  56. package/lib/commonjs/components/v2/PEPaymentRequest.js.map +1 -1
  57. package/lib/commonjs/components/v2/PayEngineNative.js +182 -4
  58. package/lib/commonjs/components/v2/PayEngineNative.js.map +1 -1
  59. package/lib/commonjs/components/v2/PayEngineProvider.js +52 -0
  60. package/lib/commonjs/components/v2/PayEngineProvider.js.map +1 -1
  61. package/lib/commonjs/components/v2/SecureFields/BankAccountView.js +71 -0
  62. package/lib/commonjs/components/v2/SecureFields/BankAccountView.js.map +1 -1
  63. package/lib/commonjs/components/v2/SecureFields/CreditCardView.js +82 -0
  64. package/lib/commonjs/components/v2/SecureFields/CreditCardView.js.map +1 -1
  65. package/lib/commonjs/components/v2/SecureFields/IPEField.js.map +1 -1
  66. package/lib/commonjs/components/v2/SecureFields/ITokenizationData.js.map +1 -1
  67. package/lib/commonjs/components/v2/SecureFields/PEBankAccount.js.map +1 -1
  68. package/lib/commonjs/components/v2/SecureFields/PECard.js.map +1 -1
  69. package/lib/commonjs/components/v2/SecureFields/PEKeyboardType.js +20 -3
  70. package/lib/commonjs/components/v2/SecureFields/PEKeyboardType.js.map +1 -1
  71. package/lib/commonjs/index.js +17 -13
  72. package/lib/commonjs/index.js.map +1 -1
  73. package/lib/commonjs/interfaces/index.js +20 -0
  74. package/lib/commonjs/interfaces/index.js.map +1 -1
  75. package/lib/commonjs/utils/index.js +26 -0
  76. package/lib/commonjs/utils/index.js.map +1 -1
  77. package/lib/module/components/PayEngine.js +1 -1
  78. package/lib/module/components/PayEngine.js.map +1 -1
  79. package/lib/module/components/v2/ApplePay/PEApplePayButton.js +124 -0
  80. package/lib/module/components/v2/ApplePay/PEApplePayButton.js.map +1 -1
  81. package/lib/module/components/v2/ApplePay/PEApplePayInterfaces.js +75 -0
  82. package/lib/module/components/v2/ApplePay/PEApplePayInterfaces.js.map +1 -1
  83. package/lib/module/components/v2/GooglePay/PEGooglePayAddress.js.map +1 -1
  84. package/lib/module/components/v2/GooglePay/PEGooglePayButton.js +53 -0
  85. package/lib/module/components/v2/GooglePay/PEGooglePayButton.js.map +1 -1
  86. package/lib/module/components/v2/PEPaymentRequest.js +119 -0
  87. package/lib/module/components/v2/PEPaymentRequest.js.map +1 -1
  88. package/lib/module/components/v2/PayEngineNative.js +184 -5
  89. package/lib/module/components/v2/PayEngineNative.js.map +1 -1
  90. package/lib/module/components/v2/PayEngineProvider.js +51 -0
  91. package/lib/module/components/v2/PayEngineProvider.js.map +1 -1
  92. package/lib/module/components/v2/SecureFields/BankAccountView.js +71 -0
  93. package/lib/module/components/v2/SecureFields/BankAccountView.js.map +1 -1
  94. package/lib/module/components/v2/SecureFields/CreditCardView.js +82 -0
  95. package/lib/module/components/v2/SecureFields/CreditCardView.js.map +1 -1
  96. package/lib/module/components/v2/SecureFields/IPEField.js.map +1 -1
  97. package/lib/module/components/v2/SecureFields/ITokenizationData.js.map +1 -1
  98. package/lib/module/components/v2/SecureFields/PEBankAccount.js.map +1 -1
  99. package/lib/module/components/v2/SecureFields/PECard.js.map +1 -1
  100. package/lib/module/components/v2/SecureFields/PEKeyboardType.js +16 -1
  101. package/lib/module/components/v2/SecureFields/PEKeyboardType.js.map +1 -1
  102. package/lib/module/index.js +10 -5
  103. package/lib/module/index.js.map +1 -1
  104. package/lib/module/interfaces/index.js +19 -0
  105. package/lib/module/interfaces/index.js.map +1 -1
  106. package/lib/module/utils/index.js +27 -0
  107. package/lib/module/utils/index.js.map +1 -1
  108. package/lib/typescript/components/PayEngine.d.ts +1 -1
  109. package/lib/typescript/components/v2/ApplePay/PEApplePayButton.d.ts +217 -12
  110. package/lib/typescript/components/v2/ApplePay/PEApplePayInterfaces.d.ts +180 -1
  111. package/lib/typescript/components/v2/GooglePay/PEGooglePayAddress.d.ts +30 -0
  112. package/lib/typescript/components/v2/GooglePay/PEGooglePayButton.d.ts +99 -0
  113. package/lib/typescript/components/v2/PEPaymentRequest.d.ts +130 -9
  114. package/lib/typescript/components/v2/PayEngineNative.d.ts +165 -7
  115. package/lib/typescript/components/v2/PayEngineProvider.d.ts +51 -0
  116. package/lib/typescript/components/v2/SecureFields/BankAccountView.d.ts +103 -0
  117. package/lib/typescript/components/v2/SecureFields/CreditCardView.d.ts +114 -0
  118. package/lib/typescript/components/v2/SecureFields/IPEField.d.ts +49 -0
  119. package/lib/typescript/components/v2/SecureFields/ITokenizationData.d.ts +14 -0
  120. package/lib/typescript/components/v2/SecureFields/PEBankAccount.d.ts +36 -0
  121. package/lib/typescript/components/v2/SecureFields/PECard.d.ts +44 -0
  122. package/lib/typescript/components/v2/SecureFields/PEKeyboardType.d.ts +16 -1
  123. package/lib/typescript/index.d.ts +11 -5
  124. package/lib/typescript/interfaces/index.d.ts +35 -1
  125. package/lib/typescript/utils/index.d.ts +21 -0
  126. package/package.json +6 -3
  127. package/react-native-payengine.podspec +1 -1
  128. package/src/components/PayEngine.tsx +1 -1
  129. package/src/components/v2/ApplePay/PEApplePayButton.tsx +225 -12
  130. package/src/components/v2/ApplePay/PEApplePayInterfaces.ts +221 -8
  131. package/src/components/v2/GooglePay/PEGooglePayAddress.ts +39 -1
  132. package/src/components/v2/GooglePay/PEGooglePayButton.tsx +113 -9
  133. package/src/components/v2/PEPaymentRequest.ts +151 -13
  134. package/src/components/v2/PayEngineNative.tsx +196 -9
  135. package/src/components/v2/PayEngineProvider.tsx +52 -1
  136. package/src/components/v2/SecureFields/BankAccountView.tsx +108 -1
  137. package/src/components/v2/SecureFields/CreditCardView.tsx +118 -1
  138. package/src/components/v2/SecureFields/IPEField.ts +55 -0
  139. package/src/components/v2/SecureFields/ITokenizationData.ts +17 -2
  140. package/src/components/v2/SecureFields/PEBankAccount.ts +42 -0
  141. package/src/components/v2/SecureFields/PECard.ts +52 -0
  142. package/src/components/v2/SecureFields/PEKeyboardType.ts +18 -1
  143. package/src/index.tsx +23 -5
  144. package/src/interfaces/index.ts +40 -2
  145. package/src/utils/index.ts +21 -0
  146. package/android/.gradle/6.1.1/executionHistory/executionHistory.lock +0 -0
  147. package/android/.gradle/6.1.1/fileChanges/last-build.bin +0 -0
  148. package/android/.gradle/6.1.1/fileHashes/fileHashes.lock +0 -0
  149. package/android/.gradle/6.1.1/gc.properties +0 -0
  150. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/CustomWindow.h +0 -25
  151. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/UIControl+CustomControl.h +0 -33
  152. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/UIViewController+TouchControl.h +0 -27
  153. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/CustomWindow.h +0 -25
  154. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/UIControl+CustomControl.h +0 -33
  155. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/UIViewController+TouchControl.h +0 -27
@@ -1,10 +1,15 @@
1
+ /**
2
+ * Main Module
3
+ * @module PayEngine SDK
4
+ */
1
5
  import PayEngine from './components/PayEngine';
2
6
  import { NativeModules, Platform } from 'react-native';
3
7
  import { PayProvider } from './interfaces/index';
4
- import { PECreditCardView, PECreditCardViewMethods } from './components/v2/SecureFields/CreditCardView';
5
- import { PEBankAccountView, PEBankAccountViewMethods } from './components/v2/SecureFields/BankAccountView';
8
+ import { PECreditCardView } from './components/v2/SecureFields/CreditCardView';
9
+ import { PEBankAccountView } from './components/v2/SecureFields/BankAccountView';
6
10
  import { PayEngineProvider } from './components/v2/PayEngineProvider';
7
11
  import PayEngineNative from './components/v2/PayEngineNative';
12
+ import { FetchAccessTokenCallback, AccessToken } from './components/v2/PayEngineNative';
8
13
  import { PEApplePayButton } from './components/v2/ApplePay/PEApplePayButton';
9
14
  import { PEGooglePayButton } from './components/v2/GooglePay/PEGooglePayButton';
10
15
  import * as PayEngineUtils from './utils/index';
@@ -22,10 +27,10 @@ const PayEngineStatic = NativeModules.Payengine ? NativeModules.Payengine : new
22
27
 
23
28
  });
24
29
  export { PayEngineStatic, PayEngine, PayProvider, // v2 starting here
25
- PayEngineUtils, PayEngineProvider, PayEngineNative, // securefields
30
+ PayEngineUtils, PayEngineProvider, PayEngineNative, AccessToken, FetchAccessTokenCallback, // securefields
26
31
  PEKeyboardType, // credit card
27
- PECreditCardView, PECreditCardViewMethods, // bank account
28
- PEBankAccountView, PEBankAccountViewMethods, // Apple Pay
32
+ PECreditCardView, // bank account
33
+ PEBankAccountView, // Apple Pay
29
34
  PEApplePayButton, // RNPEGooglePayBillingAddressParameters,
30
35
  // RNPEGooglePayShippingAddressParameters,
31
36
  // PEPaymentRequest,
@@ -1 +1 @@
1
- {"version":3,"names":["PayEngine","NativeModules","Platform","PayProvider","PECreditCardView","PECreditCardViewMethods","PEBankAccountView","PEBankAccountViewMethods","PayEngineProvider","PayEngineNative","PEApplePayButton","PEGooglePayButton","PayEngineUtils","PEKeyboardType","LINKING_ERROR","select","ios","default","PayEngineStatic","Payengine","Proxy","get","Error"],"sources":["index.tsx"],"sourcesContent":["import PayEngine from './components/PayEngine';\nimport { NativeModules, Platform } from 'react-native';\nimport type { IPayEngineConfig } from './interfaces/index';\nimport { PayProvider } from './interfaces/index';\nimport {\n PECreditCardView,\n PECreditCardViewMethods,\n} from './components/v2/SecureFields/CreditCardView';\nimport {\n PEBankAccountView,\n 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 { PEApplePayButton } from './components/v2/ApplePay/PEApplePayButton';\n\nimport { PEGooglePayButton } 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 // securefields\n PEKeyboardType,\n IPEField,\n // credit card\n PECreditCardView,\n PECreditCardViewMethods,\n PECard,\n // bank account\n PEBankAccountView,\n PEBankAccountViewMethods,\n PEBankAccount,\n // Apple Pay\n PEApplePayButton,\n // RNPEApplePayOptions,\n // RNPEContactField,\n PEApplePayContact,\n // RNPEGooglePayBillingAddressParameters,\n // RNPEGooglePayShippingAddressParameters,\n // PEPaymentRequest,\n PEGooglePayButton,\n PEGooglePayAddress\n};\n"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,wBAAtB;AACA,SAASC,aAAT,EAAwBC,QAAxB,QAAwC,cAAxC;AAEA,SAASC,WAAT,QAA4B,oBAA5B;AACA,SACEC,gBADF,EAEEC,uBAFF,QAGO,6CAHP;AAIA,SACEC,iBADF,EAEEC,wBAFF,QAGO,8CAHP;AAOA,SAASC,iBAAT,QAAkC,mCAAlC;AACA,OAAOC,eAAP,MAA4B,iCAA5B;AACA,SAASC,gBAAT,QAAiC,2CAAjC;AAEA,SAASC,iBAAT,QAAkC,6CAAlC;AACA,OAAO,KAAKC,cAAZ,MAAgC,eAAhC;AACA,OAAOC,cAAP,MAA2B,6CAA3B;AAIA,cAAc,kCAAd;AACA,cAAc,+CAAd;AAGA,MAAMC,aAAa,GAChB,iFAAD,GACAZ,QAAQ,CAACa,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,eAAe,GAAGjB,aAAa,CAACkB,SAAd,GACpBlB,aAAa,CAACkB,SADM,GAEpB,IAAIC,KAAJ,CACE,EADF,EAEE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUR,aAAV,CAAN;EACD;;AAHH,CAFF,CAFJ;AAWA,SACEI,eADF,EAEElB,SAFF,EAIEG,WAJF,EAKE;AACAS,cANF,EAOEJ,iBAPF,EAQEC,eARF,EASE;AACAI,cAVF,EAYE;AACAT,gBAbF,EAcEC,uBAdF,EAgBE;AACAC,iBAjBF,EAkBEC,wBAlBF,EAoBE;AACAG,gBArBF,EAyBE;AACA;AACA;AACAC,iBA5BF"}
1
+ {"version":3,"names":["PayEngine","NativeModules","Platform","PayProvider","PECreditCardView","PEBankAccountView","PayEngineProvider","PayEngineNative","FetchAccessTokenCallback","AccessToken","PEApplePayButton","PEGooglePayButton","PayEngineUtils","PEKeyboardType","LINKING_ERROR","select","ios","default","PayEngineStatic","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":"AAAA;AACA;AACA;AACA;AAEA,OAAOA,SAAP,MAAsB,wBAAtB;AACA,SAASC,aAAT,EAAwBC,QAAxB,QAAwC,cAAxC;AAEA,SAASC,WAAT,QAA4B,oBAA5B;AAEA,SACEC,gBADF,QAIO,6CAJP;AAKA,SACEC,iBADF,QAIO,8CAJP;AAQA,SAASC,iBAAT,QAAkC,mCAAlC;AACA,OAAOC,eAAP,MAA4B,iCAA5B;AACA,SAASC,wBAAT,EAAmCC,WAAnC,QAAsD,iCAAtD;AACA,SAASC,gBAAT,QAA2F,2CAA3F;AAEA,SAASC,iBAAT,QAA8F,6CAA9F;AACA,OAAO,KAAKC,cAAZ,MAAgC,eAAhC;AACA,OAAOC,cAAP,MAA2B,6CAA3B;AAIA,cAAc,kCAAd;AACA,cAAc,+CAAd;AAGA,MAAMC,aAAa,GAChB,iFAAD,GACAZ,QAAQ,CAACa,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,eAAe,GAAGjB,aAAa,CAACkB,SAAd,GACpBlB,aAAa,CAACkB,SADM,GAEpB,IAAIC,KAAJ,CACE,EADF,EAEE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUR,aAAV,CAAN;EACD;;AAHH,CAFF,CAFJ;AAWA,SACEI,eADF,EAEElB,SAFF,EAIEG,WAJF,EAKE;AACAS,cANF,EAOEN,iBAPF,EAQEC,eARF,EASEE,WATF,EAUED,wBAVF,EAWE;AACAK,cAZF,EAeE;AACAT,gBAhBF,EAoBE;AACAC,iBArBF,EAyBE;AACAK,gBA1BF,EAgCE;AACA;AACA;AACAC,iBAnCF"}
@@ -1,3 +1,22 @@
1
+ /**
2
+ * Represents the configuration settings for PayEngine.
3
+ *
4
+ * The [IPayEngineConfig] interface holds essential details such as the public key,
5
+ * script version, and logging level. It is used to configure the PayEngine integration
6
+ * for API interactions.
7
+ *
8
+ */
9
+
10
+ /**
11
+ * Enum representing supported payment providers.
12
+ *
13
+ * @remarks
14
+ * This enum specifies the available payment providers supported by the PayEngine SDK.
15
+ * It is used to check which payment method (Apple Pay or Google Pay) is available for use.
16
+ *
17
+ * @enum {string}
18
+ * @category PayEngine
19
+ */
1
20
  export let PayProvider;
2
21
 
3
22
  (function (PayProvider) {
@@ -1 +1 @@
1
- {"version":3,"names":["PayProvider"],"sources":["index.ts"],"sourcesContent":["export interface IPayEngineConfig {\n publicKey: string;\n version?: string;\n scriptURL?: string;\n logLevel?: number;\n}\n\nexport enum PayProvider {\n googlePay,\n applePay\n}"],"mappings":"AAOA,WAAYA,WAAZ;;WAAYA,W;EAAAA,W,CAAAA,W;EAAAA,W,CAAAA,W;GAAAA,W,KAAAA,W"}
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;AACA,WAAYA,WAAZ;;WAAYA,W;EAAAA,W,CAAAA,W;EAAAA,W,CAAAA,W;GAAAA,W,KAAAA,W"}
@@ -1,15 +1,30 @@
1
1
  import axios from 'axios';
2
+
3
+ /**
4
+ * Custom error thrown when an obsolete method is called.
5
+ *
6
+ * The `PEDeprecationError` indicates that the method being used is deprecated,
7
+ * and the user should check the package README for updated usage.
8
+ */
2
9
  export class PEDeprecationError extends Error {
3
10
  constructor() {
4
11
  super('This method is obsolete and can not be used anymore. Please check out the package README');
5
12
  }
6
13
 
7
14
  }
15
+ /**
16
+ * @private
17
+ */
18
+
8
19
  export const getHttpHeaders = config => {
9
20
  return {
10
21
  Authorization: `Signature key="${config.publicKey}",algorithm="hmac-sha256",identifier="secure-fields",signature=""`
11
22
  };
12
23
  };
24
+ /**
25
+ * @private
26
+ */
27
+
13
28
  export const getBaseURL = config => {
14
29
  let baseUrl = config.publicKey.includes('_prod_') ? 'https://console.payengine.co' : 'https://console.payengine.dev';
15
30
 
@@ -19,12 +34,20 @@ export const getBaseURL = config => {
19
34
 
20
35
  return baseUrl;
21
36
  };
37
+ /**
38
+ * @private
39
+ */
40
+
22
41
  export const createHttpClient = config => {
23
42
  return axios.create({
24
43
  baseURL: getBaseURL(config),
25
44
  headers: getHttpHeaders(config)
26
45
  });
27
46
  };
47
+ /**
48
+ * @private
49
+ */
50
+
28
51
  export function getScriptURL(config) {
29
52
  if (!config.publicKey) {
30
53
  throw new Error('PayEngine Public Key is missing');
@@ -43,6 +66,10 @@ export function getScriptURL(config) {
43
66
 
44
67
  return scriptURL;
45
68
  }
69
+ /**
70
+ * @private
71
+ */
72
+
46
73
  export const debuggingScript = `
47
74
  const consoleLog = (type, ...log) => window.ReactNativeWebView.postMessage(JSON.stringify({'type': 'Console', 'data': {'type': type, 'log': log}}));
48
75
  console = {
@@ -1 +1 @@
1
- {"version":3,"names":["axios","PEDeprecationError","Error","constructor","getHttpHeaders","config","Authorization","publicKey","getBaseURL","baseUrl","includes","scriptURL","replace","createHttpClient","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,OAAOA,KAAP,MAAkB,OAAlB;AAGA,OAAO,MAAMC,kBAAN,SAAiCC,KAAjC,CAAuC;EAC5CC,WAAW,GAAG;IACZ,MACE,0FADF;EAGD;;AAL2C;AAQ9C,OAAO,MAAMC,cAAc,GAAIC,MAAD,IAA8B;EAC1D,OAAO;IACLC,aAAa,EAAG,kBAAiBD,MAAM,CAACE,SAAU;EAD7C,CAAP;AAGD,CAJM;AAMP,OAAO,MAAMC,UAAU,GAAIH,MAAD,IAA8B;EACtD,IAAII,OAAO,GAAGJ,MAAM,CAACE,SAAP,CAAiBG,QAAjB,CAA0B,QAA1B,IACV,8BADU,GAEV,+BAFJ;;EAIA,IAAIL,MAAM,CAACM,SAAX,EAAsB;IACpBF,OAAO,GAAGJ,MAAM,CAACM,SAAP,CAAiBC,OAAjB,CAAyB,4BAAzB,EAAuD,IAAvD,CAAV;EACD;;EACD,OAAOH,OAAP;AACD,CATM;AAWP,OAAO,MAAMI,gBAAgB,GAAIR,MAAD,IAA8B;EAC5D,OAAOL,KAAK,CAACc,MAAN,CAAa;IAClBC,OAAO,EAAEP,UAAU,CAACH,MAAD,CADD;IAElBW,OAAO,EAAEZ,cAAc,CAACC,MAAD;EAFL,CAAb,CAAP;AAID,CALM;AAOP,OAAO,SAASY,YAAT,CAAsBZ,MAAtB,EAAgD;EACrD,IAAI,CAACA,MAAM,CAACE,SAAZ,EAAuB;IACrB,MAAM,IAAIL,KAAJ,CAAU,iCAAV,CAAN;EACD;;EACD,IAAIS,SAAS,GAAG,EAAhB;EACA,MAAMO,WAAW,GAAGb,MAAM,CAACc,QAAP,GAAmB,aAAYd,MAAM,CAACc,QAAS,EAA/C,GAAmD,EAAvE;;EACA,IAAId,MAAM,CAACM,SAAX,EAAsB;IACpBA,SAAS,GAAI,GAAEN,MAAM,CAACM,SAAU,QAAON,MAAM,CAACE,SAAU,GAAEW,WAAY,EAAtE;EACD,CAFD,MAEO;IACL,MAAMH,OAAO,GAAGV,MAAM,CAACE,SAAP,CAAiBG,QAAjB,CAA0B,QAA1B,IACZ,8BADY,GAEZ,+BAFJ;IAGA,MAAMU,OAAO,GAAGf,MAAM,CAACe,OAAP,IAAkB,OAAlC;IACAT,SAAS,GAAI,GAAEI,OAAQ,OAAMK,OAAQ,iBAAgBf,MAAM,CAACE,SAAU,GAAEW,WAAY,EAApF;EACD;;EAED,OAAOP,SAAP;AACD;AAED,OAAO,MAAMU,eAAe,GAAI;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAxBO"}
1
+ {"version":3,"names":["axios","PEDeprecationError","Error","constructor","getHttpHeaders","config","Authorization","publicKey","getBaseURL","baseUrl","includes","scriptURL","replace","createHttpClient","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,OAAOA,KAAP,MAAkB,OAAlB;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAAN,SAAiCC,KAAjC,CAAuC;EAC5CC,WAAW,GAAG;IACZ,MACE,0FADF;EAGD;;AAL2C;AAQ9C;AACA;AACA;;AACA,OAAO,MAAMC,cAAc,GAAIC,MAAD,IAA8B;EAC1D,OAAO;IACLC,aAAa,EAAG,kBAAiBD,MAAM,CAACE,SAAU;EAD7C,CAAP;AAGD,CAJM;AAMP;AACA;AACA;;AACA,OAAO,MAAMC,UAAU,GAAIH,MAAD,IAA8B;EACtD,IAAII,OAAO,GAAGJ,MAAM,CAACE,SAAP,CAAiBG,QAAjB,CAA0B,QAA1B,IACV,8BADU,GAEV,+BAFJ;;EAIA,IAAIL,MAAM,CAACM,SAAX,EAAsB;IACpBF,OAAO,GAAGJ,MAAM,CAACM,SAAP,CAAiBC,OAAjB,CAAyB,4BAAzB,EAAuD,IAAvD,CAAV;EACD;;EACD,OAAOH,OAAP;AACD,CATM;AAWP;AACA;AACA;;AACA,OAAO,MAAMI,gBAAgB,GAAIR,MAAD,IAA8B;EAC5D,OAAOL,KAAK,CAACc,MAAN,CAAa;IAClBC,OAAO,EAAEP,UAAU,CAACH,MAAD,CADD;IAElBW,OAAO,EAAEZ,cAAc,CAACC,MAAD;EAFL,CAAb,CAAP;AAID,CALM;AAOP;AACA;AACA;;AACA,OAAO,SAASY,YAAT,CAAsBZ,MAAtB,EAAgD;EACrD,IAAI,CAACA,MAAM,CAACE,SAAZ,EAAuB;IACrB,MAAM,IAAIL,KAAJ,CAAU,iCAAV,CAAN;EACD;;EACD,IAAIS,SAAS,GAAG,EAAhB;EACA,MAAMO,WAAW,GAAGb,MAAM,CAACc,QAAP,GAAmB,aAAYd,MAAM,CAACc,QAAS,EAA/C,GAAmD,EAAvE;;EACA,IAAId,MAAM,CAACM,SAAX,EAAsB;IACpBA,SAAS,GAAI,GAAEN,MAAM,CAACM,SAAU,QAAON,MAAM,CAACE,SAAU,GAAEW,WAAY,EAAtE;EACD,CAFD,MAEO;IACL,MAAMH,OAAO,GAAGV,MAAM,CAACE,SAAP,CAAiBG,QAAjB,CAA0B,QAA1B,IACZ,8BADY,GAEZ,+BAFJ;IAGA,MAAMU,OAAO,GAAGf,MAAM,CAACe,OAAP,IAAkB,OAAlC;IACAT,SAAS,GAAI,GAAEI,OAAQ,OAAMK,OAAQ,iBAAgBf,MAAM,CAACE,SAAU,GAAEW,WAAY,EAApF;EACD;;EAED,OAAOP,SAAP;AACD;AAED;AACA;AACA;;AACA,OAAO,MAAMU,eAAe,GAAI;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAxBO"}
@@ -1,2 +1,2 @@
1
- declare const PayEngine: () => JSX.Element;
1
+ declare const PayEngine: (_props: any) => JSX.Element;
2
2
  export default PayEngine;
@@ -2,15 +2,57 @@ import * as React from 'react';
2
2
  import { ViewProps } from 'react-native';
3
3
  import type { PEPaymentRequest, PESummaryItem } from '../PEPaymentRequest';
4
4
  import type { PEApplePayContact, PEApplePayPaymentMethod, PEApplePaySheetError, PEApplePayShippingMethod } from './PEApplePayInterfaces';
5
+ /**
6
+ * Props for the Apple Pay button component.
7
+ *
8
+ * This interface defines the properties you can pass to the Apple Pay button,
9
+ * including the payment request and various event callbacks triggered throughout
10
+ * the Apple Pay flow.
11
+ *
12
+ * @category Apple Pay
13
+ */
5
14
  export interface PEApplePayButtonProps extends ViewProps {
15
+ /**
16
+ * The payment request containing transaction details such as the total amount,
17
+ * currency, supported networks, and required contact fields.
18
+ */
6
19
  paymentRequest: PEPaymentRequest;
20
+ /**
21
+ * Callback triggered when the Apple Pay token is successfully generated.
22
+ *
23
+ * @param token - A string representing the Apple Pay payment token.
24
+ * @param metadata - Optional metadata related to the transaction.
25
+ * @param billingContact - The billing contact information (if available).
26
+ * @param shippingContact - The shipping contact information (if available).
27
+ *
28
+ * Example:
29
+ * ```ts
30
+ * onTokenDidReturn: (token, metadata, billing, shipping) => {
31
+ * console.log('Token:', token);
32
+ * console.log('Billing contact:', billing?.givenName);
33
+ * console.log('Shipping contact:', shipping?.givenName);
34
+ * }
35
+ * ```
36
+ */
7
37
  onTokenDidReturn?: (token: string, metadata?: any, billingContact?: PEApplePayContact, shippingContact?: PEApplePayContact) => void;
38
+ /**
39
+ * Callback triggered when the Apple Pay sheet is dismissed,
40
+ * either by completing the payment or canceling it.
41
+ */
8
42
  onPaymentSheetDismissed?: () => void;
43
+ /**
44
+ * Callback triggered when the Apple Pay process fails.
45
+ *
46
+ * @param error - The error that occurred during the payment flow.
47
+ */
9
48
  onPaymentFailed?: (error: Error) => void;
10
49
  /**
11
- * This callback is triggered whenever the payment method changes in the Apple Pay sheet.
12
- * You MUST update the Apple Pay sheet in your callback using the updatePaymentSheet function,
13
- * otherwise the Apple Pay sheet will hang and the payment flow will automatically cancel.
50
+ * Callback triggered when the user selects or changes the payment method
51
+ * within the Apple Pay sheet.
52
+ *
53
+ * You MUST call `updatePaymentSheet` in response to this callback to update
54
+ * the Apple Pay sheet. Failing to do so will cause the sheet to hang
55
+ * and the transaction will automatically cancel.
14
56
  */
15
57
  onPaymentMethodSelected?: (event: {
16
58
  nativeEvent: {
@@ -18,9 +60,12 @@ export interface PEApplePayButtonProps extends ViewProps {
18
60
  };
19
61
  }) => void;
20
62
  /**
21
- * This callback is triggered whenever the user selects a shipping method in the Apple Pay sheet.
22
- * You MUST update the Apple Pay sheet in your callback using the updatePaymentSheet function,
23
- * otherwise the Apple Pay sheet will hang and the payment flow will automatically cancel.
63
+ * Callback triggered when the user selects a shipping contact
64
+ * (e.g., their shipping address) within the Apple Pay sheet.
65
+ *
66
+ * You MUST call `updatePaymentSheet` in response to this callback to update
67
+ * shipping methods, summary items, or errors. Failure to do so will hang the
68
+ * sheet and cancel the transaction automatically.
24
69
  */
25
70
  onShippingContactSelected?: (event: {
26
71
  nativeEvent: {
@@ -28,9 +73,12 @@ export interface PEApplePayButtonProps extends ViewProps {
28
73
  };
29
74
  }) => void;
30
75
  /**
31
- * This callback is triggered whenever the user selects a shipping contact in the Apple Pay sheet.
32
- * You MUST update the Apple Pay sheet in your callback using the updatePaymentSheet function,
33
- * otherwise the Apple Pay sheet will hang and the payment flow will automatically cancel.
76
+ * Callback triggered when the user selects a shipping method (e.g., standard or express)
77
+ * in the Apple Pay sheet.
78
+ *
79
+ * You MUST call `updatePaymentSheet` in response to this callback to reflect
80
+ * any changes in pricing or available options. If you don't, the Apple Pay sheet
81
+ * will hang and the payment will be canceled.
34
82
  */
35
83
  onShippingMethodSelected?: (event: {
36
84
  nativeEvent: {
@@ -38,12 +86,169 @@ export interface PEApplePayButtonProps extends ViewProps {
38
86
  };
39
87
  }) => void;
40
88
  }
89
+ /**
90
+ * Exposes imperative methods for controlling the Apple Pay payment sheet.
91
+ *
92
+ * This interface is typically used via a `ref` to programmatically update
93
+ * the state of the Apple Pay sheet after certain user interactions.
94
+ *
95
+ * Specifically, the `updatePaymentSheet` method should be called in response to
96
+ * any of the following events:
97
+ * - `onPaymentMethodSelected`
98
+ * - `onShippingContactSelected`
99
+ * - `onShippingMethodSelected`
100
+ *
101
+ * @category Apple Pay
102
+ */
41
103
  export interface PEApplePayButtonMethods {
42
104
  /**
43
- * This method must be called after either onPaymentMethodSelected, onShippingContactSelected or
44
- * onShippingMethodSelected callbacks are triggered.
45
- * `shippingMethods` and `errors` are only applicable for onShippingContactSelected callback
105
+ * Updates the Apple Pay payment sheet with new summary items, shipping methods, and validation errors.
106
+ *
107
+ * This method should be called in response to user selections made on the Apple Pay sheet,
108
+ * such as selecting a new payment method, shipping contact, or shipping method.
109
+ *
110
+ * ### Parameters:
111
+ * - `summaryItems`: The updated list of items summarizing the total payment amount (e.g., subtotal, tax, total).
112
+ * - `shippingMethods`: A list of available shipping methods based on the selected shipping contact.
113
+ * - Only applicable when the `onShippingContactSelected` callback is triggered.
114
+ * - `errors`: A list of validation errors (e.g., invalid address or unsupported shipping region).
115
+ * - Also only applicable for `onShippingContactSelected`.
116
+ *
117
+ * ### Returns:
118
+ * - A `Promise<boolean>` indicating whether the update was successful.
119
+ *
120
+ * ### Example:
121
+ * ```ts
122
+ * await ref.current?.updatePaymentSheet(
123
+ * updatedSummaryItems,
124
+ * availableShippingMethods,
125
+ * validationErrors
126
+ * );
127
+ * ```
46
128
  */
47
129
  updatePaymentSheet: (summaryItems: PESummaryItem[], shippingMethods: PEApplePayShippingMethod[], errors: PEApplePaySheetError[]) => Promise<boolean>;
48
130
  }
131
+ /**
132
+ * A React component for initiating an Apple Pay transaction.
133
+ *
134
+ * This button wraps the Apple Pay experience, including presenting the Apple Pay sheet,
135
+ * handling user interactions, processing the payment, and managing callbacks such as
136
+ * payment success, failure, and contact/method selection.
137
+ *
138
+ * It exposes imperative methods via `ref` to allow control over the Apple Pay sheet,
139
+ * such as updating summary items or shipping options in response to user input.
140
+ *
141
+ * ## Example Usage:
142
+ *
143
+ * ```tsx
144
+ * const paymentRequest = {
145
+ * merchantId: "merchant.com.example",
146
+ * countryCode: "US",
147
+ * currencyCode: "USD",
148
+ * paymentAmount: 10.00,
149
+ * paymentSummaryItems: [
150
+ * { label: "Test Item", amount: "10.00" }
151
+ * ],
152
+ * requiredShippingContactFields: ["name", "postalAddress"]
153
+ * };
154
+ *
155
+ * <PEApplePayButton
156
+ * paymentRequest={paymentRequest}
157
+ *
158
+ * // Triggered when payment fails
159
+ * onPaymentFailed={(error) => console.error("Payment failed:", error)}
160
+ *
161
+ * // Triggered when Apple Pay sheet is dismissed by the user
162
+ * onPaymentSheetDismissed={() => console.log("Payment sheet dismissed")}
163
+ *
164
+ * // Triggered when a valid token is generated after successful Apple Pay authorization
165
+ * onTokenDidReturn={(token, metadata, billingContact, shippingContact) => {
166
+ * console.log('Apple Pay token:', token, metadata, billingContact, shippingContact);
167
+ * // TODO: Send token to your server for processing
168
+ * purchaseWithToken(token);
169
+ * }}
170
+ *
171
+ * // Triggered when user selects or updates their shipping contact info
172
+ * onShippingContactSelected={(event) => {
173
+ * console.log('onShippingContactSelected', event.nativeEvent);
174
+ *
175
+ * if (!event.nativeEvent.contact.postalCode) {
176
+ * // Invalid postal code — update Apple Pay sheet with an error
177
+ * buttonRef?.current?.updatePaymentSheet([], [], [{
178
+ * errorType: PEApplePaySheetErrorType.InvalidShippingAddress,
179
+ * field: PEApplePayInvalidShippingField.PostalCode,
180
+ * message: 'Please update postal code to continue'
181
+ * }]);
182
+ * } else {
183
+ * // Provide updated shipping methods if contact is valid
184
+ * buttonRef?.current?.updatePaymentSheet([], [
185
+ * {
186
+ * identifier: 'new-shipping1',
187
+ * label: 'Updated shipping 1',
188
+ * amount: 3.99
189
+ * },
190
+ * {
191
+ * identifier: 'new-shipping2',
192
+ * label: 'Updated shipping 2',
193
+ * amount: 5.99
194
+ * }
195
+ * ], []);
196
+ * }
197
+ * }}
198
+ *
199
+ * // Triggered when user selects a shipping method
200
+ * onShippingMethodSelected={(event) => {
201
+ * console.log('onShippingMethodSelected', event.nativeEvent);
202
+ *
203
+ * const shippingFee = event.nativeEvent.shippingMethod.amount;
204
+ * const items = [
205
+ * {
206
+ * label: 'Product price',
207
+ * amount: paymentRequest.paymentAmount
208
+ * },
209
+ * ...(shippingFee > 0 ? [{
210
+ * label: 'Shipping Fee',
211
+ * amount: shippingFee
212
+ * }] : []),
213
+ * {
214
+ * label: 'Total',
215
+ * amount: paymentRequest.paymentAmount + shippingFee
216
+ * }
217
+ * ];
218
+ *
219
+ * buttonRef?.current?.updatePaymentSheet(items, [], []);
220
+ * }}
221
+ *
222
+ * // Triggered when user selects a payment method (e.g., credit, debit)
223
+ * onPaymentMethodSelected={(event) => {
224
+ * console.log('onPaymentMethodSelected', event.nativeEvent);
225
+ *
226
+ * const isCredit = event.nativeEvent.paymentMethod.type === PEApplePayPaymentMethodType.credit;
227
+ * const items = [
228
+ * {
229
+ * label: 'Product price',
230
+ * amount: paymentRequest.paymentAmount
231
+ * },
232
+ * ...(isCredit ? [{
233
+ * label: 'Credit discount',
234
+ * amount: 10
235
+ * }] : []),
236
+ * {
237
+ * label: 'Total',
238
+ * amount: paymentRequest.paymentAmount - (isCredit ? 1.00 : 0.00)
239
+ * }
240
+ * ];
241
+ *
242
+ * buttonRef?.current?.updatePaymentSheet(items, [], []);
243
+ * }}
244
+ *
245
+ * ref={applePayRef}
246
+ * />
247
+ * ```
248
+ *
249
+ * @param props - The props for configuring the Apple Pay button behavior.
250
+ * @param ref - A ref to access Apple Pay sheet update methods imperatively.
251
+ *
252
+ * @category Apple Pay
253
+ */
49
254
  export declare const PEApplePayButton: React.ForwardRefExoticComponent<PEApplePayButtonProps & React.RefAttributes<PEApplePayButtonMethods>>;