react-native-hyperswitch-dev-sdk 0.4.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 (262) hide show
  1. package/HyperswitchSdkReactNative.podspec +42 -0
  2. package/LICENSE +201 -0
  3. package/android/build.gradle +161 -0
  4. package/android/gradle.properties +5 -0
  5. package/android/hyperswitch_autolinking.gradle +378 -0
  6. package/android/proguard-rules.pro +72 -0
  7. package/android/src/legacy/java/com/facebook/react/viewmanagers/GooglePayButtonManagerDelegate.java +41 -0
  8. package/android/src/legacy/java/com/facebook/react/viewmanagers/GooglePayButtonManagerInterface.java +20 -0
  9. package/android/src/legacy/java/com/facebook/react/viewmanagers/NativePaymentWidgetManagerDelegate.java +38 -0
  10. package/android/src/legacy/java/com/facebook/react/viewmanagers/NativePaymentWidgetManagerInterface.java +21 -0
  11. package/android/src/legacy/java/com/hyperswitchsdkreactnative/NativeHyperswitchSdkNativeSpec.java +106 -0
  12. package/android/src/legacy/java/com/hyperswitchsdkreactnative/NativeHyperswitchSdkReactNativeSpec.java +77 -0
  13. package/android/src/legacy/java/com/hyperswitchsdkreactnative/NativePaymentWidgetNativeSpec.java +36 -0
  14. package/android/src/main/AndroidManifest.xml +15 -0
  15. package/android/src/main/assets/hyperswitch.bundle +1535 -0
  16. package/android/src/main/java/com/hyperswitchsdkreactnative/HyperswitchSdkReactNativePackage.kt +47 -0
  17. package/android/src/main/java/com/hyperswitchsdkreactnative/modules/NativePaymentWidgetModule.kt +173 -0
  18. package/android/src/main/java/com/hyperswitchsdkreactnative/modules/ReactNativeHyperswitchModule.kt +396 -0
  19. package/android/src/main/java/com/hyperswitchsdkreactnative/views/PaymentElementViewManager.kt +99 -0
  20. package/android/src/main/java/io/hyperswitch/HyperswitchReactPackageProvider.kt +19 -0
  21. package/android/src/main/java/io/hyperswitch/PaymentEventType.kt +18 -0
  22. package/android/src/main/java/io/hyperswitch/model/ElementConfiguration.kt +58 -0
  23. package/android/src/main/java/io/hyperswitch/paymentsession/ExitHeadlessCallBackManager.kt +47 -0
  24. package/android/src/main/java/io/hyperswitch/paymentsession/GetPaymentSessionCallBackManager.kt +23 -0
  25. package/android/src/main/java/io/hyperswitch/paymentsession/PaymentMethod.kt +167 -0
  26. package/android/src/main/java/io/hyperswitch/paymentsession/PaymentSessionHandler.kt +68 -0
  27. package/android/src/main/java/io/hyperswitch/paymentsession/PaymentSessionHandlerImpl.kt +179 -0
  28. package/android/src/main/java/io/hyperswitch/paymentsession/PaymentSessionReactLauncher.kt +226 -0
  29. package/android/src/main/java/io/hyperswitch/paymentsession/PaymentSheetCallbackManager.kt +40 -0
  30. package/android/src/main/java/io/hyperswitch/paymentsheet/PaymentResult.kt +63 -0
  31. package/android/src/main/java/io/hyperswitch/react/GooglePayButtonManager.kt +54 -0
  32. package/android/src/main/java/io/hyperswitch/react/HyperActivity.kt +73 -0
  33. package/android/src/main/java/io/hyperswitch/react/HyperEventEmitter.kt +144 -0
  34. package/android/src/main/java/io/hyperswitch/react/HyperFragment.kt +429 -0
  35. package/android/src/main/java/io/hyperswitch/react/HyperFragmentManager.kt +155 -0
  36. package/android/src/main/java/io/hyperswitch/react/HyperHeadlessModule.kt +43 -0
  37. package/android/src/main/java/io/hyperswitch/react/HyperModule.kt +405 -0
  38. package/android/src/main/java/io/hyperswitch/react/HyperPackage.kt +16 -0
  39. package/android/src/main/java/io/hyperswitch/react/ReactNativeController.kt +251 -0
  40. package/android/src/main/java/io/hyperswitch/utils/ConversionUtils.kt +256 -0
  41. package/android/src/main/java/io/hyperswitch/utils/StandardResult.kt +45 -0
  42. package/android/src/main/java/io/hyperswitch/view/GooglePayButtonView.kt +59 -0
  43. package/android/src/main/java/io/hyperswitch/view/PaymentWidgetView.kt +405 -0
  44. package/android/src/main/res/values/attrs.xml +6 -0
  45. package/android/src/main/res/values/strings.xml +5 -0
  46. package/android/src/main/res/values/theme.xml +16 -0
  47. package/ios/Modules/ReactNative/HyperswitchModule.swift +470 -0
  48. package/ios/Modules/ReactNative/HyperswitchSdkReactNative.h +5 -0
  49. package/ios/Modules/ReactNative/HyperswitchSdkReactNative.mm +121 -0
  50. package/ios/Modules/ReactNative/NativeHyperswitchModule.h +18 -0
  51. package/ios/Modules/ReactNative/NativeHyperswitchModule.mm +165 -0
  52. package/ios/Modules/ReactNative/NativeHyperswitchModuleImpl.swift +290 -0
  53. package/ios/Modules/ReactNative/NativePaymentElementModule.mm +129 -0
  54. package/ios/Views/Fabric/ApplePayView.h +14 -0
  55. package/ios/Views/Fabric/ApplePayView.mm +89 -0
  56. package/ios/Views/Fabric/NativePaymentElementView.h +21 -0
  57. package/ios/Views/Fabric/NativePaymentElementView.mm +200 -0
  58. package/ios/Views/Fabric/NativePaymentWidgetViewRegistry.h +37 -0
  59. package/ios/Views/Fabric/NativePaymentWidgetViewRegistry.m +45 -0
  60. package/ios/Views/Native/NativePaymentWidget.m +26 -0
  61. package/ios/Views/Native/NativePaymentWidget.swift +420 -0
  62. package/ios/hyperswitchSDK/Core/ApplePay/ApplePayHandler.swift +261 -0
  63. package/ios/hyperswitchSDK/Core/ApplePay/ApplePayViewManager.m +18 -0
  64. package/ios/hyperswitchSDK/Core/ApplePay/ApplePayViewManager.swift +126 -0
  65. package/ios/hyperswitchSDK/Core/DeviceDataCollection/HeadlessWebView.swift +144 -0
  66. package/ios/hyperswitchSDK/Core/HyperCVCWidget/CVCWidget.swift +136 -0
  67. package/ios/hyperswitchSDK/Core/HyperExpressCheckout/ExpressCheckoutLauncher.swift +116 -0
  68. package/ios/hyperswitchSDK/Core/HyperExpressCheckout/ExpressCheckoutWidget.swift +42 -0
  69. package/ios/hyperswitchSDK/Core/HyperPaymentCardTextField/PaymentCardTextField+SwiftUI.swift +67 -0
  70. package/ios/hyperswitchSDK/Core/HyperPaymentCardTextField/PaymentCardTextField.swift +44 -0
  71. package/ios/hyperswitchSDK/Core/HyperPaymentCardTextField/PaymentHandler.swift +59 -0
  72. package/ios/hyperswitchSDK/Core/HyperPaymentCardTextField/PaymentIntentParams.swift +31 -0
  73. package/ios/hyperswitchSDK/Core/HyperPaymentCardTextField/PaymentMethodParams.swift +25 -0
  74. package/ios/hyperswitchSDK/Core/HyperPaymentMethodManagement/PaymentManagementConfiguration.swift +213 -0
  75. package/ios/hyperswitchSDK/Core/HyperPaymentMethodManagement/PaymentMethodManagementWidget.swift +92 -0
  76. package/ios/hyperswitchSDK/Core/HyperPaymentSheet/PaymentSheet+Events.swift +36 -0
  77. package/ios/hyperswitchSDK/Core/HyperPaymentSheet/PaymentSheetView+SwiftUI.swift +49 -0
  78. package/ios/hyperswitchSDK/Core/HyperPaymentSheet/PaymentSheetView+UIKit.swift +49 -0
  79. package/ios/hyperswitchSDK/Core/HyperPaymentSheet/PaymentSheetView.swift +68 -0
  80. package/ios/hyperswitchSDK/Core/HyperPaymentWidget/PaymentWidget.swift +212 -0
  81. package/ios/hyperswitchSDK/Core/HyperSession/PaymentSession+UIKit.swift +228 -0
  82. package/ios/hyperswitchSDK/Core/HyperSession/PaymentSessionTypes.swift +174 -0
  83. package/ios/hyperswitchSDK/Core/NativeModule/HyperHeadless.m +15 -0
  84. package/ios/hyperswitchSDK/Core/NativeModule/HyperHeadless.swift +108 -0
  85. package/ios/hyperswitchSDK/Core/NativeModule/HyperModule.m +31 -0
  86. package/ios/hyperswitchSDK/Core/NativeModule/HyperModule.swift +343 -0
  87. package/ios/hyperswitchSDK/Core/NativeModule/OTAServices.swift +117 -0
  88. package/ios/hyperswitchSDK/Core/NativeModule/RNHeadlessManager.swift +47 -0
  89. package/ios/hyperswitchSDK/Core/NativeModule/RNResponseHandler.swift +12 -0
  90. package/ios/hyperswitchSDK/Core/NativeModule/RNViewManager.swift +55 -0
  91. package/ios/hyperswitchSDK/Core/NativeModule/WidgetAction.swift +30 -0
  92. package/ios/hyperswitchSDK/Core/NativeModule/WidgetResponseRegistry.swift +92 -0
  93. package/ios/hyperswitchSDK/Core/NativeModule/hyper-Bridging-Header.h +12 -0
  94. package/ios/hyperswitchSDK/Core/Resources/HyperOTA.plist +20 -0
  95. package/ios/hyperswitchSDK/Core/Resources/hyperswitch.bundle +1531 -0
  96. package/ios/hyperswitchSDK/CoreLite/ApplePayHandlerLite.swift +251 -0
  97. package/ios/hyperswitchSDK/CoreLite/PaymentSession+Lite.swift +25 -0
  98. package/ios/hyperswitchSDK/CoreLite/PaymentSheetView+Lite.swift +45 -0
  99. package/ios/hyperswitchSDK/CoreLite/SwiftUI+Lite.swift +48 -0
  100. package/ios/hyperswitchSDK/CoreLite/WebViewController.swift +278 -0
  101. package/ios/hyperswitchSDK/Shared/APIClient.swift +22 -0
  102. package/ios/hyperswitchSDK/Shared/Codable+UIKit.swift +75 -0
  103. package/ios/hyperswitchSDK/Shared/CustomEndpointConfiguration.swift +67 -0
  104. package/ios/hyperswitchSDK/Shared/DictionaryConverter.swift +104 -0
  105. package/ios/hyperswitchSDK/Shared/Environment.swift +24 -0
  106. package/ios/hyperswitchSDK/Shared/Extensions.swift +101 -0
  107. package/ios/hyperswitchSDK/Shared/Helper.swift +40 -0
  108. package/ios/hyperswitchSDK/Shared/HyperEvents/PaymentEventData.swift +125 -0
  109. package/ios/hyperswitchSDK/Shared/HyperEvents/PaymentEventSubscriptionBuilder.swift +45 -0
  110. package/ios/hyperswitchSDK/Shared/HyperEvents/PaymentEventType.swift +30 -0
  111. package/ios/hyperswitchSDK/Shared/HyperNetworking.swift +151 -0
  112. package/ios/hyperswitchSDK/Shared/HyperParams.swift +44 -0
  113. package/ios/hyperswitchSDK/Shared/HyperUIViewController.swift +27 -0
  114. package/ios/hyperswitchSDK/Shared/Hyperswitch.swift +20 -0
  115. package/ios/hyperswitchSDK/Shared/HyperswitchConfigurationSchema.swift +54 -0
  116. package/ios/hyperswitchSDK/Shared/HyperswitchEnvironment.swift +11 -0
  117. package/ios/hyperswitchSDK/Shared/NativeLogger/Debouncer.swift +37 -0
  118. package/ios/hyperswitchSDK/Shared/NativeLogger/LogBuilder.swift +113 -0
  119. package/ios/hyperswitchSDK/Shared/NativeLogger/LogFileManager.swift +76 -0
  120. package/ios/hyperswitchSDK/Shared/NativeLogger/LogManager.swift +113 -0
  121. package/ios/hyperswitchSDK/Shared/NativeLogger/LogPayload.swift +91 -0
  122. package/ios/hyperswitchSDK/Shared/PaymentMethodType.swift +15 -0
  123. package/ios/hyperswitchSDK/Shared/PaymentSession.swift +98 -0
  124. package/ios/hyperswitchSDK/Shared/PaymentSessionConfiguration.swift +14 -0
  125. package/ios/hyperswitchSDK/Shared/PaymentSheet.swift +33 -0
  126. package/ios/hyperswitchSDK/Shared/PaymentSheetAppearance+Codable.swift +182 -0
  127. package/ios/hyperswitchSDK/Shared/PaymentSheetAppearance.swift +238 -0
  128. package/ios/hyperswitchSDK/Shared/PaymentSheetConfiguration.swift +161 -0
  129. package/ios/hyperswitchSDK/Shared/SDKParams.swift +43 -0
  130. package/ios/hyperswitchSDK/Shared/SavedPaymentMethodsConfiguration.swift +20 -0
  131. package/ios/hyperswitchSDK/Shared/SwiftUIManager.swift +28 -0
  132. package/ios/hyperswitchSDK/Shared/Version.swift +12 -0
  133. package/lib/bs/JuspayTechReactNativeHyperswitch.cmi +0 -0
  134. package/lib/bs/JuspayTechReactNativeHyperswitch.cmj +0 -0
  135. package/lib/bs/JuspayTechReactNativeHyperswitch.cmt +0 -0
  136. package/lib/bs/JuspayTechReactNativeHyperswitch.mlmap +0 -0
  137. package/lib/bs/build.ninja +8 -0
  138. package/lib/bs/install.ninja +9 -0
  139. package/lib/bs/src/context/HyperProvider-JuspayTechReactNativeHyperswitch.cmt +0 -0
  140. package/lib/bs/src/context/WidgetRegistry-JuspayTechReactNativeHyperswitch.cmt +0 -0
  141. package/lib/bs/src/core/Hyper-JuspayTechReactNativeHyperswitch.cmt +0 -0
  142. package/lib/bs/src/core/HyperElements-JuspayTechReactNativeHyperswitch.cmt +0 -0
  143. package/lib/bs/src/hooks/usePaymentSession-JuspayTechReactNativeHyperswitch.cmt +0 -0
  144. package/lib/bs/src/hooks/useWidget-JuspayTechReactNativeHyperswitch.cmt +0 -0
  145. package/lib/bs/src/modules/NativeHyperswitchSdk-JuspayTechReactNativeHyperswitch.cmt +0 -0
  146. package/lib/bs/src/types/HyperTypes-JuspayTechReactNativeHyperswitch.cmt +0 -0
  147. package/lib/bs/src/types/NativeModuleTypes-JuspayTechReactNativeHyperswitch.cmt +0 -0
  148. package/lib/bs/src/types/PaymentSheetConfiguration-JuspayTechReactNativeHyperswitch.cmt +0 -0
  149. package/lib/bs/src/utils/AppearanceTransformer-JuspayTechReactNativeHyperswitch.cmt +0 -0
  150. package/lib/bs/src/utils/EventValidator-JuspayTechReactNativeHyperswitch.cmt +0 -0
  151. package/lib/bs/src/utils/NewArchUtils-JuspayTechReactNativeHyperswitch.cmt +0 -0
  152. package/lib/bs/src/utils/PaymentSheetEventManager-JuspayTechReactNativeHyperswitch.cmt +0 -0
  153. package/lib/bs/src/utils/ReactNativeUtils-JuspayTechReactNativeHyperswitch.cmt +0 -0
  154. package/lib/bs/src/utils/ResponseHandler-JuspayTechReactNativeHyperswitch.cmt +0 -0
  155. package/lib/bs/src/views/CVCElement-JuspayTechReactNativeHyperswitch.cmt +0 -0
  156. package/lib/bs/src/views/NativePaymentWidget-JuspayTechReactNativeHyperswitch.cmt +0 -0
  157. package/lib/bs/src/views/NativePaymentWidgetImpl-JuspayTechReactNativeHyperswitch.cmt +0 -0
  158. package/lib/bs/src/views/PaymentElement-JuspayTechReactNativeHyperswitch.cmt +0 -0
  159. package/lib/commonjs/index.bundle.js +2 -0
  160. package/lib/commonjs/index.bundle.js.map +1 -0
  161. package/lib/module/index.bundle.js +2 -0
  162. package/lib/module/index.bundle.js.map +1 -0
  163. package/lib/typescript/babel.config.d.ts +10 -0
  164. package/lib/typescript/babel.config.d.ts.map +1 -0
  165. package/lib/typescript/eslint.config.d.mts +3 -0
  166. package/lib/typescript/eslint.config.d.mts.map +1 -0
  167. package/lib/typescript/rollup.config.d.ts +23 -0
  168. package/lib/typescript/rollup.config.d.ts.map +1 -0
  169. package/lib/typescript/scripts/bootstrap.d.ts +2 -0
  170. package/lib/typescript/scripts/bootstrap.d.ts.map +1 -0
  171. package/lib/typescript/src/context/Elements.d.ts +7 -0
  172. package/lib/typescript/src/context/Elements.d.ts.map +1 -0
  173. package/lib/typescript/src/context/HyperElements.d.ts +23 -0
  174. package/lib/typescript/src/context/HyperElements.d.ts.map +1 -0
  175. package/lib/typescript/src/context/PaymentSession.d.ts +15 -0
  176. package/lib/typescript/src/context/PaymentSession.d.ts.map +1 -0
  177. package/lib/typescript/src/context/SavedPaymentMethods.d.ts +5 -0
  178. package/lib/typescript/src/context/SavedPaymentMethods.d.ts.map +1 -0
  179. package/lib/typescript/src/context/WidgetRegistry.d.ts +8 -0
  180. package/lib/typescript/src/context/WidgetRegistry.d.ts.map +1 -0
  181. package/lib/typescript/src/context/hooks.d.ts +5 -0
  182. package/lib/typescript/src/context/hooks.d.ts.map +1 -0
  183. package/lib/typescript/src/index.d.ts +10 -0
  184. package/lib/typescript/src/index.d.ts.map +1 -0
  185. package/lib/typescript/src/modules/NativeHyperswitchSdk.d.ts +61 -0
  186. package/lib/typescript/src/modules/NativeHyperswitchSdk.d.ts.map +1 -0
  187. package/lib/typescript/src/specs/ApplePayViewNativeComponent.d.ts +10 -0
  188. package/lib/typescript/src/specs/ApplePayViewNativeComponent.d.ts.map +1 -0
  189. package/lib/typescript/src/specs/NativeHyperHeadless.d.ts +14 -0
  190. package/lib/typescript/src/specs/NativeHyperHeadless.d.ts.map +1 -0
  191. package/lib/typescript/src/specs/NativeHyperswitchModule.d.ts +32 -0
  192. package/lib/typescript/src/specs/NativeHyperswitchModule.d.ts.map +1 -0
  193. package/lib/typescript/src/specs/NativeHyperswitchSdkNative.d.ts +33 -0
  194. package/lib/typescript/src/specs/NativeHyperswitchSdkNative.d.ts.map +1 -0
  195. package/lib/typescript/src/specs/NativePaymentElementModule.d.ts +9 -0
  196. package/lib/typescript/src/specs/NativePaymentElementModule.d.ts.map +1 -0
  197. package/lib/typescript/src/specs/PaymentElementNativeComponent.d.ts +19 -0
  198. package/lib/typescript/src/specs/PaymentElementNativeComponent.d.ts.map +1 -0
  199. package/lib/typescript/src/specs/utils.d.ts +15 -0
  200. package/lib/typescript/src/specs/utils.d.ts.map +1 -0
  201. package/lib/typescript/src/types/NativeModuleTypes.d.ts +67 -0
  202. package/lib/typescript/src/types/NativeModuleTypes.d.ts.map +1 -0
  203. package/lib/typescript/src/types/PaymentSheetConfiguration.d.ts +255 -0
  204. package/lib/typescript/src/types/PaymentSheetConfiguration.d.ts.map +1 -0
  205. package/lib/typescript/src/types/definitions.d.ts +85 -0
  206. package/lib/typescript/src/types/definitions.d.ts.map +1 -0
  207. package/lib/typescript/src/types/elements/index.d.ts +23 -0
  208. package/lib/typescript/src/types/elements/index.d.ts.map +1 -0
  209. package/lib/typescript/src/types/paymentresult/index.d.ts +5 -0
  210. package/lib/typescript/src/types/paymentresult/index.d.ts.map +1 -0
  211. package/lib/typescript/src/types/savedPaymentMethods/index.d.ts +69 -0
  212. package/lib/typescript/src/types/savedPaymentMethods/index.d.ts.map +1 -0
  213. package/lib/typescript/src/utils/EventValidator.d.ts +9 -0
  214. package/lib/typescript/src/utils/EventValidator.d.ts.map +1 -0
  215. package/lib/typescript/src/utils/InitializationState.d.ts +13 -0
  216. package/lib/typescript/src/utils/InitializationState.d.ts.map +1 -0
  217. package/lib/typescript/src/utils/LaunchOptions.d.ts +7 -0
  218. package/lib/typescript/src/utils/LaunchOptions.d.ts.map +1 -0
  219. package/lib/typescript/src/utils/NewArchUtils.d.ts +7 -0
  220. package/lib/typescript/src/utils/NewArchUtils.d.ts.map +1 -0
  221. package/lib/typescript/src/utils/ReactNativeUtils.d.ts +3 -0
  222. package/lib/typescript/src/utils/ReactNativeUtils.d.ts.map +1 -0
  223. package/lib/typescript/src/views/CVCElement.d.ts +15 -0
  224. package/lib/typescript/src/views/CVCElement.d.ts.map +1 -0
  225. package/lib/typescript/src/views/NativePaymentWidget.d.ts +3 -0
  226. package/lib/typescript/src/views/NativePaymentWidget.d.ts.map +1 -0
  227. package/lib/typescript/src/views/NativePaymentWidgetImpl.d.ts +5 -0
  228. package/lib/typescript/src/views/NativePaymentWidgetImpl.d.ts.map +1 -0
  229. package/lib/typescript/src/views/PaymentElement.d.ts +18 -0
  230. package/lib/typescript/src/views/PaymentElement.d.ts.map +1 -0
  231. package/package.json +184 -0
  232. package/src/context/Elements.ts +80 -0
  233. package/src/context/HyperElements.tsx +81 -0
  234. package/src/context/PaymentSession.ts +121 -0
  235. package/src/context/SavedPaymentMethods.ts +80 -0
  236. package/src/context/WidgetRegistry.ts +74 -0
  237. package/src/context/hooks.ts +79 -0
  238. package/src/index.ts +53 -0
  239. package/src/modules/NativeHyperswitchSdk.ts +155 -0
  240. package/src/specs/ApplePayViewNativeComponent.ts +11 -0
  241. package/src/specs/NativeHyperHeadless.ts +22 -0
  242. package/src/specs/NativeHyperswitchModule.ts +51 -0
  243. package/src/specs/NativeHyperswitchSdkNative.ts +62 -0
  244. package/src/specs/NativePaymentElementModule.ts +25 -0
  245. package/src/specs/PaymentElementNativeComponent.ts +21 -0
  246. package/src/specs/utils.ts +15 -0
  247. package/src/types/NativeModuleTypes.ts +73 -0
  248. package/src/types/PaymentSheetConfiguration.ts +360 -0
  249. package/src/types/definitions.ts +109 -0
  250. package/src/types/elements/index.ts +33 -0
  251. package/src/types/paymentresult/index.ts +4 -0
  252. package/src/types/savedPaymentMethods/index.ts +74 -0
  253. package/src/utils/EventValidator.ts +39 -0
  254. package/src/utils/InitializationState.ts +28 -0
  255. package/src/utils/LaunchOptions.ts +41 -0
  256. package/src/utils/NewArchUtils.ts +18 -0
  257. package/src/utils/ReactNativeUtils.ts +13 -0
  258. package/src/views/CVCElement.tsx +122 -0
  259. package/src/views/NativePaymentWidget.ts +2 -0
  260. package/src/views/NativePaymentWidgetImpl.ts +16 -0
  261. package/src/views/PaymentElement.tsx +189 -0
  262. package/tsconfig.build.json +21 -0
@@ -0,0 +1,109 @@
1
+ import type { PaymentResult } from './paymentresult';
2
+
3
+ export interface OverrideEndpointConfiguration {
4
+ customBackendEndpoint?: string;
5
+ customLoggingEndpoint?: string;
6
+ customAssetEndpoint?: string;
7
+ customSDKConfigEndpoint?: string;
8
+ customAirborneEndpoint?: string;
9
+ }
10
+
11
+ export interface CommonEndpoint {
12
+ commonEndpoint: string;
13
+ }
14
+
15
+ export interface OverrideEndpoints {
16
+ overrideEndpoints: OverrideEndpointConfiguration;
17
+ }
18
+
19
+ export type HyperswitchEnvironment = 'PROD' | 'SANDBOX' | 'INTEG';
20
+
21
+ export type ElementType = 'paymentElement' | 'cvcWidget';
22
+
23
+
24
+ export interface HyperswitchConfiguration {
25
+ publishableKey: string;
26
+ platformPublishableKey?: string;
27
+ profileId?: string;
28
+ environment?: HyperswitchEnvironment;
29
+ customEndpoints?: CommonEndpoint | OverrideEndpoints;
30
+ }
31
+
32
+ export interface PaymentSessionConfiguration {
33
+ sdkAuthorization: string;
34
+ }
35
+
36
+ /**
37
+ * Full payload sent to the native SDK. It is assembled internally from the
38
+ * merchant-supplied configuration plus the SDK/payment-session metadata.
39
+ */
40
+ export interface NativePaymentSheetPayload {
41
+ hyperswitchConfig: Record<string, unknown>;
42
+ paymentSessionConfig: { sdkAuthorization: string };
43
+ configuration: Record<string, unknown>;
44
+ }
45
+
46
+ import type { ComponentType } from 'react';
47
+ import { CustomerSavedPaymentMethodsSession } from './savedPaymentMethods';
48
+ import type { Elements } from './elements';
49
+
50
+
51
+
52
+
53
+
54
+ export interface PaymentSession {
55
+ presentPaymentSheet(
56
+ configuration?: Record<string, unknown>
57
+ ): Promise<PaymentResult>;
58
+ getCustomerSavedPaymentMethods(
59
+ options?: any
60
+ ): Promise<CustomerSavedPaymentMethodsSession>;
61
+ updateIntent(
62
+ intentResolver: () => Promise<PaymentSessionConfiguration>
63
+ ): Promise<void>;
64
+ }
65
+
66
+ export interface PaymentElementHandle {
67
+ confirmPayment(options?: {
68
+ confirmParams?: Record<string, any>;
69
+ }): Promise<PaymentResult>;
70
+ collapse(): void;
71
+ focus(): void;
72
+ blur(): void;
73
+ clear(): void;
74
+ update(options: Record<string, any>): void;
75
+ destroy(): void;
76
+ }
77
+
78
+ export interface PaymentElement extends PaymentElementHandle {
79
+ Component?: ComponentType<any>;
80
+ mount(selector: string): void;
81
+ unmount(): void;
82
+ on(event: string, handler?: (data?: any) => void): { remove: () => void };
83
+ onPaymentResult(handler?: (data: PaymentResult) => void): {
84
+ remove: () => void;
85
+ };
86
+ onPaymentConfirmButtonClick(handler?: (data: any) => boolean): {
87
+ remove: () => void;
88
+ };
89
+ }
90
+
91
+ export interface CvcWidget {
92
+ Component?: ComponentType<any>;
93
+ mount(selector: string, options?: Record<string, any>): void;
94
+ unmount(): void;
95
+ destroy(): void;
96
+ on(
97
+ event: string,
98
+ handler?: (data?: any) => void
99
+ ): { remove: () => void } | null;
100
+ }
101
+
102
+
103
+ export interface HyperswitchSession {
104
+ publishableKey: string;
105
+ elements(options: PaymentSessionConfiguration): Promise<Elements>;
106
+ initPaymentSession(
107
+ options: PaymentSessionConfiguration
108
+ ): Promise<PaymentSession>;
109
+ }
@@ -0,0 +1,33 @@
1
+ import { PaymentResult } from "../paymentresult";
2
+ import type {
3
+ PaymentElementHandle,
4
+ PaymentSessionConfiguration,
5
+ } from "../definitions";
6
+ import { CustomerSavedPaymentMethodsSession } from "../savedPaymentMethods";
7
+
8
+ export interface Elements {
9
+ confirmPayment(
10
+ paymentElementRef: { current: PaymentElementHandle | null } | string,
11
+ options?: { confirmParams?: Record<string, any> }
12
+ ): Promise<PaymentResult>;
13
+ presentPaymentSheet(
14
+ configuration?: Record<string, unknown>
15
+ ): Promise<PaymentResult>;
16
+ updateIntent(
17
+ intentResolver: () => Promise<PaymentSessionConfiguration>
18
+ ): Promise<void>;
19
+ getCustomerSavedPaymentMethods(
20
+ options?: any
21
+ ): Promise<CustomerSavedPaymentMethodsSession>;
22
+ }
23
+
24
+ export interface ElementsActions {
25
+ confirmPayment: (
26
+ paymentElementRef: { current: PaymentElementHandle | null } | string,
27
+ options?: { confirmParams?: Record<string, any> }
28
+ ) => Promise<PaymentResult>;
29
+ updateIntent: (
30
+ intentResolver: () => Promise<PaymentSessionConfiguration>
31
+ ) => Promise<void>;
32
+ getCustomerSavedPaymentMethods(): Promise<CustomerSavedPaymentMethodsSession>;
33
+ }
@@ -0,0 +1,4 @@
1
+ export interface PaymentResult {
2
+ type: 'completed' | 'canceled' | 'failed';
3
+ message?: string;
4
+ }
@@ -0,0 +1,74 @@
1
+ import type { PaymentResult } from '../paymentresult';
2
+
3
+ export interface SavedPaymentMethodsConfiguration {
4
+ hiddenPaymentMethods?: string[];
5
+ }
6
+
7
+ export interface CustomerLastUsedPaymentMethodCard {
8
+ scheme: string;
9
+ issuer_country: string;
10
+ last4_digits: string;
11
+ expiry_month: string;
12
+ expiry_year: string;
13
+ card_token: string | null;
14
+ card_holder_name: string;
15
+ card_fingerprint: string | null;
16
+ nick_name: string;
17
+ card_network: string;
18
+ card_isin: string;
19
+ card_issuer: string;
20
+ card_type: string;
21
+ saved_to_locker: boolean;
22
+ }
23
+
24
+ export interface CustomerPaymentMethodBillingAddress {
25
+ line1?: string;
26
+ line2?: string;
27
+ line3?: string;
28
+ city?: string;
29
+ state?: string;
30
+ country?: string;
31
+ first_name?: string;
32
+ last_name?: string;
33
+ }
34
+
35
+ export interface CustomerPaymentMethodBilling {
36
+ address?: CustomerPaymentMethodBillingAddress;
37
+ phone?: Record<string, unknown>;
38
+ email?: string;
39
+ }
40
+
41
+ export interface CustomerLastUsedPaymentMethod {
42
+ payment_token: string;
43
+ payment_method_id: string;
44
+ customer_id: string;
45
+ payment_method: string;
46
+ payment_method_type: string;
47
+ payment_method_issuer: string;
48
+ payment_method_issuer_code: string | null;
49
+ recurring_enabled: boolean;
50
+ installment_payment_enabled: boolean;
51
+ payment_experience: string[];
52
+ card: CustomerLastUsedPaymentMethodCard | null;
53
+ metadata: string | null;
54
+ created: string;
55
+ bank: string | null;
56
+ surcharge_details: string | null;
57
+ requires_cvv: boolean;
58
+ last_used_at: string;
59
+ default_payment_method_set: boolean;
60
+ billing: CustomerPaymentMethodBilling | null;
61
+ error?: any;
62
+ }
63
+
64
+ export interface CustomerSavedPaymentMethodsSession {
65
+ getCustomerLastUsedPaymentMethodData(): Promise<CustomerLastUsedPaymentMethod | null>;
66
+ getCustomerDefaultSavedPaymentMethodData(): Promise<CustomerLastUsedPaymentMethod | null>;
67
+ getCustomerSavedPaymentMethodData(): Promise<CustomerLastUsedPaymentMethod | null>;
68
+ confirmWithCustomerLastUsedPaymentMethod(args?: {
69
+ id?: string;
70
+ }): Promise<PaymentResult>;
71
+ confirmWithCustomerDefaultPaymentMethod?(args?: {
72
+ id?: string;
73
+ }): Promise<PaymentResult>;
74
+ }
@@ -0,0 +1,39 @@
1
+ const validEventStrings = [
2
+ 'PAYMENT_METHOD_INFO_CARD',
3
+ 'PAYMENT_METHOD_STATUS',
4
+ 'FORM_STATUS',
5
+ 'PAYMENT_METHOD_INFO_ADDRESS',
6
+ 'PAYMENT_METHOD_INFO_BILLING_ADDRESS',
7
+ 'CVC_STATUS',
8
+ ];
9
+
10
+ export function getValidEventsString(): string {
11
+ return validEventStrings.join(', ');
12
+ }
13
+
14
+ export function validateSubscribedEventStrings(
15
+ subscribedEvents: string[] | undefined
16
+ ): string[] {
17
+ if (!subscribedEvents) {
18
+ return [];
19
+ }
20
+ return subscribedEvents.filter((event) => !validEventStrings.includes(event));
21
+ }
22
+
23
+ export type UnknownEventWarningPayload = {
24
+ message: string;
25
+ invalidEvents: string[];
26
+ validEvents: string[];
27
+ };
28
+
29
+ export function makeUnknownEventWarningPayload(
30
+ invalidEvents: string[]
31
+ ): UnknownEventWarningPayload {
32
+ const invalidEventsStr = invalidEvents.join(', ');
33
+ const validEventsStr = getValidEventsString();
34
+ return {
35
+ message: `Unknown event(s) subscribed: [${invalidEventsStr}]. Valid events are: ${validEventsStr}`,
36
+ invalidEvents,
37
+ validEvents: validEventStrings,
38
+ };
39
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Tracks whether the Hyperswitch SDK is currently initialising (or re-initialising
3
+ * after a reload). presentPaymentSheet should be blocked while this flag is true
4
+ * so the native SDK is not asked to open a sheet before it is ready.
5
+ *
6
+ * Also tracks whether a payment sheet is currently presented so that a hot-reload
7
+ * (or any other code path) cannot stack a second sheet on top of an open one.
8
+ */
9
+
10
+ let _isInitializing = false;
11
+
12
+ export function setInitializing(value: boolean): void {
13
+ _isInitializing = value;
14
+ }
15
+
16
+ export function isInitializing(): boolean {
17
+ return _isInitializing;
18
+ }
19
+
20
+ let _isSheetPresented = false;
21
+
22
+ export function setSheetPresented(value: boolean): void {
23
+ _isSheetPresented = value;
24
+ }
25
+
26
+ export function isSheetPresented(): boolean {
27
+ return _isSheetPresented;
28
+ }
@@ -0,0 +1,41 @@
1
+ import type {
2
+ HyperswitchConfiguration,
3
+ NativePaymentSheetPayload,
4
+ } from '../types/definitions';
5
+ import type { PaymentSessionConfiguration } from '../types/definitions';
6
+ import { PaymentResult } from '../types/paymentresult';
7
+
8
+ function buildPresentPaymentSheetPayload(
9
+ hyperswitchConfig: HyperswitchConfiguration,
10
+ paymentSessionConfig: PaymentSessionConfiguration,
11
+ configuration: Record<string, unknown> = {},
12
+ ): NativePaymentSheetPayload {
13
+ // platformPublishableKey is internal to the RN bridge; it is not part of the
14
+ // merchant-facing hyperswitchConfig payload.
15
+ const { platformPublishableKey: _platformPublishableKey, ...restConfig } =
16
+ hyperswitchConfig;
17
+
18
+ return {
19
+ hyperswitchConfig: restConfig as Record<string, unknown>,
20
+ paymentSessionConfig: paymentSessionConfig,
21
+ configuration,
22
+ };
23
+ }
24
+
25
+ function mapStatus(status: string): PaymentResult['type'] {
26
+ switch (status) {
27
+ case 'succeeded':
28
+ case 'completed':
29
+ case 'success':
30
+ return 'completed';
31
+ case 'cancelled':
32
+ case 'canceled':
33
+ return 'canceled';
34
+ case 'failed':
35
+ case 'error':
36
+ default:
37
+ return 'failed';
38
+ }
39
+ }
40
+
41
+ export { buildPresentPaymentSheetPayload, mapStatus };
@@ -0,0 +1,18 @@
1
+ declare global {
2
+ var __turboModuleProxy: unknown | undefined;
3
+ var nativeFabricUIManager: unknown | undefined;
4
+ }
5
+
6
+ export function isTurboModuleEnabled(): boolean {
7
+ return (
8
+ typeof global.__turboModuleProxy !== 'undefined' &&
9
+ global.__turboModuleProxy !== null
10
+ );
11
+ }
12
+
13
+ export function isFabricEnabled(): boolean {
14
+ return (
15
+ typeof global.nativeFabricUIManager !== 'undefined' &&
16
+ global.nativeFabricUIManager !== null
17
+ );
18
+ }
@@ -0,0 +1,13 @@
1
+ import { UIManager, findNodeHandle } from 'react-native';
2
+
3
+ export function dispatchViewManagerCommand(
4
+ viewId: number,
5
+ commandId: number,
6
+ commandArgs: number[]
7
+ ): void {
8
+ UIManager.dispatchViewManagerCommand(viewId, commandId, commandArgs);
9
+ }
10
+
11
+ export function getFindNodeHandle(ref: unknown): number {
12
+ return findNodeHandle(ref as React.ElementRef<typeof UIManager>) ?? -1;
13
+ }
@@ -0,0 +1,122 @@
1
+ import { forwardRef, useEffect, useRef, useState } from 'react';
2
+ import type { ViewStyle } from 'react-native';
3
+ import { registerWidget, unregisterWidget } from '../context/WidgetRegistry';
4
+ import { getFindNodeHandle } from '../utils/ReactNativeUtils';
5
+ import type {
6
+ paymentEventResult,
7
+ paymentResult,
8
+ paymentEventNative,
9
+ } from '../types/NativeModuleTypes';
10
+ import type { PaymentSheetConfiguration } from '../types/PaymentSheetConfiguration';
11
+ import NativePaymentWidgetImpl from './NativePaymentWidgetImpl';
12
+
13
+ type CVCElementProps = {
14
+ id?: string;
15
+ options?: PaymentSheetConfiguration;
16
+ onChange?: (event: paymentEventResult) => void;
17
+ onFocus?: () => void;
18
+ onBlur?: () => void;
19
+ onPaymentResult?: (result: paymentResult) => void;
20
+ style?: ViewStyle;
21
+ };
22
+
23
+ function parsePaymentResult(result: string): paymentResult {
24
+ return JSON.parse(result);
25
+ }
26
+
27
+ export const CVCElementView = forwardRef<unknown, CVCElementProps>(
28
+ (props, ref) => {
29
+ const {
30
+ id,
31
+ options,
32
+ onChange,
33
+ onFocus,
34
+ onBlur,
35
+ onPaymentResult,
36
+ style,
37
+ } = props;
38
+ // const {paymentSessionConfig, hyperswitchConfig} = useHyperElementsContext();
39
+ const [viewId, setViewId] = useState<number | undefined>(undefined);
40
+ const viewRef = useRef<unknown>(null);
41
+
42
+ useEffect(() => {
43
+ let isMounted = true;
44
+ const findNodeHandle = (attempt: number) => {
45
+ if (!isMounted || viewId !== undefined) return;
46
+ if (viewRef.current != null) {
47
+ const nativeId = getFindNodeHandle(viewRef.current);
48
+ if (nativeId !== -1) {
49
+ setViewId(nativeId);
50
+ } else if (attempt < 20) {
51
+ setTimeout(() => findNodeHandle(attempt + 1), 100);
52
+ }
53
+ } else if (attempt < 20) {
54
+ setTimeout(() => findNodeHandle(attempt + 1), 100);
55
+ }
56
+ };
57
+ findNodeHandle(0);
58
+ return () => {
59
+ isMounted = false;
60
+ };
61
+ }, [viewId]);
62
+
63
+ useEffect(() => {
64
+ if (!id || viewId === undefined) return undefined;
65
+ registerWidget(id, viewId);
66
+ return () => unregisterWidget(id);
67
+ }, [id, viewId]);
68
+
69
+ const onPaymentEventInternal = (event: paymentEventNative) => {
70
+ onChange?.(event.nativeEvent);
71
+
72
+ if (event.nativeEvent.eventName === 'CVC_STATUS') {
73
+ try {
74
+ const outerDict = event.nativeEvent.payload as
75
+ | Record<string, unknown>
76
+ | undefined;
77
+ if (!outerDict) {
78
+ return;
79
+ }
80
+ const cvcStatus = outerDict.cvcStatus as
81
+ | Record<string, unknown>
82
+ | undefined;
83
+ if (!cvcStatus) {
84
+ return;
85
+ }
86
+ const isCvcFocused = Boolean(cvcStatus.isCvcFocused);
87
+ const isCvcBlur = Boolean(cvcStatus.isCvcBlur);
88
+ if (isCvcFocused) {
89
+ onFocus?.();
90
+ }
91
+ if (isCvcBlur) {
92
+ onBlur?.();
93
+ }
94
+ } catch {
95
+ // Ignore malformed native events
96
+ }
97
+ }
98
+ };
99
+
100
+ const onPaymentResultInternal = (event: {
101
+ nativeEvent: { result?: string };
102
+ }) => {
103
+ onPaymentResult?.(parsePaymentResult(event.nativeEvent.result ?? ''));
104
+ };
105
+
106
+ return (
107
+ <NativePaymentWidgetImpl
108
+ ref={viewRef}
109
+ widgetType="widgetPaymentSheet"
110
+ sdkAuthorization={paymentSessionConfig?.sdkAuthorization ?? ''}
111
+ onPaymentEvent={onPaymentEventInternal}
112
+ onPaymentResult={onPaymentResultInternal}
113
+ options={{
114
+ hyperswitchConfig,
115
+ paymentSessionConfig,
116
+ configuration: options,
117
+ }}
118
+ style={style}
119
+ />
120
+ );
121
+ }
122
+ );
@@ -0,0 +1,2 @@
1
+ export { default as make } from './NativePaymentWidgetImpl';
2
+ export type { nativePaymentWidgetType as props } from '../types/NativeModuleTypes';
@@ -0,0 +1,16 @@
1
+ import { requireNativeComponent } from 'react-native';
2
+ import { isFabricEnabled } from '../utils/NewArchUtils';
3
+ import type { nativePaymentWidgetType } from '../types/NativeModuleTypes';
4
+
5
+ type NativePaymentWidgetComponent =
6
+ React.ComponentType<nativePaymentWidgetType>;
7
+
8
+ const NativePaymentWidgetImpl: NativePaymentWidgetComponent =
9
+ isFabricEnabled()
10
+ ? (require('../specs/PaymentElementNativeComponent')
11
+ .default as NativePaymentWidgetComponent)
12
+ : (requireNativeComponent(
13
+ 'NativePaymentWidget'
14
+ ) as NativePaymentWidgetComponent);
15
+
16
+ export default NativePaymentWidgetImpl;
@@ -0,0 +1,189 @@
1
+ import {
2
+ forwardRef,
3
+ useEffect,
4
+ useImperativeHandle,
5
+ useRef,
6
+ useState,
7
+ } from 'react';
8
+ import type { ViewStyle } from 'react-native';
9
+ import NativePaymentWidgetImpl from './NativePaymentWidgetImpl';
10
+ import { registerWidget, unregisterWidget } from '../context/WidgetRegistry';
11
+ import { confirmPayment as nativeConfirmPayment } from '../modules/NativeHyperswitchSdk';
12
+ import type { paymentResult } from '../modules/NativeHyperswitchSdk';
13
+ import type { PaymentSheetConfiguration } from '../types/PaymentSheetConfiguration';
14
+ import {
15
+ dispatchViewManagerCommand,
16
+ getFindNodeHandle,
17
+ } from '../utils/ReactNativeUtils';
18
+ import {
19
+ makeUnknownEventWarningPayload,
20
+ validateSubscribedEventStrings,
21
+ } from '../utils/EventValidator';
22
+ import type {
23
+ paymentEventResult,
24
+ paymentEventNative,
25
+ nativeEvent,
26
+ } from '../types/NativeModuleTypes';
27
+
28
+ function parsePaymentResult(result: string): paymentResult {
29
+ return JSON.parse(result);
30
+ }
31
+
32
+ type PaymentWidgetRef = {
33
+ confirmPayment: () => Promise<paymentResult>;
34
+ };
35
+
36
+ type PaymentElementProps = {
37
+ widgetId: string;
38
+ options?: PaymentSheetConfiguration;
39
+ onPaymentResult: (result: paymentResult) => void;
40
+ // onPaymentConfirmButtonClick:() =>void;
41
+ onChange?: (event: paymentEventResult) => void;
42
+ onReady?: (event: string) => void;
43
+ style?: ViewStyle;
44
+ };
45
+
46
+ export const PaymentElementView = forwardRef<
47
+ PaymentWidgetRef,
48
+ PaymentElementProps
49
+ >((props, ref) => {
50
+ const {
51
+ widgetId,
52
+ options,
53
+ onPaymentResult,
54
+ onChange,
55
+ style,
56
+ } = props;
57
+ const [viewId, setViewId] = useState<number | undefined>(undefined);
58
+ const viewRef = useRef<unknown>(null);
59
+ const isRegisteredRef = useRef(false);
60
+
61
+ useEffect(() => {
62
+ let isMounted = true;
63
+
64
+ const findNodeHandle = (attempt: number) => {
65
+ if (!isMounted || viewId !== undefined) {
66
+ return;
67
+ }
68
+ if (viewRef.current != null) {
69
+ const id = getFindNodeHandle(viewRef.current);
70
+ if (id !== -1) {
71
+ setViewId(id);
72
+ } else if (attempt < 20) {
73
+ setTimeout(() => findNodeHandle(attempt + 1), 100);
74
+ }
75
+ } else if (attempt < 20) {
76
+ setTimeout(() => findNodeHandle(attempt + 1), 100);
77
+ }
78
+ };
79
+
80
+ findNodeHandle(3);
81
+
82
+ return () => {
83
+ isMounted = false;
84
+ };
85
+ }, [viewId]);
86
+
87
+ useEffect(() => {
88
+ if (viewId !== undefined) {
89
+ registerWidget(widgetId, viewId);
90
+ isRegisteredRef.current = true;
91
+ return () => {
92
+ if (isRegisteredRef.current) {
93
+ unregisterWidget(widgetId);
94
+ isRegisteredRef.current = false;
95
+ }
96
+ };
97
+ }
98
+ return undefined;
99
+ }, [viewId, widgetId]);
100
+
101
+ useEffect(() => {
102
+ if (viewId !== undefined) {
103
+ dispatchViewManagerCommand(viewId, 1, []);
104
+ }
105
+ }, [viewId]);
106
+
107
+ useImperativeHandle(
108
+ ref,
109
+ () => ({
110
+ confirmPayment: (): Promise<paymentResult> => {
111
+ if (viewRef.current == null) {
112
+ return Promise.resolve({
113
+ status: 'failed',
114
+ message: 'Widget not ready',
115
+ error: 'Widget not ready',
116
+ type: undefined,
117
+ });
118
+ }
119
+ const id = getFindNodeHandle(viewRef.current);
120
+ if (id === -1) {
121
+ return Promise.resolve({
122
+ status: 'failed',
123
+ message: 'Widget not ready',
124
+ error: 'Unable to find native view handle',
125
+ type: undefined,
126
+ });
127
+ }
128
+ return new Promise((resolve) => {
129
+ nativeConfirmPayment(id, (result: paymentResult) => {
130
+ resolve({
131
+ status: result.status,
132
+ message: result.message,
133
+ type: result.type,
134
+ });
135
+ });
136
+ });
137
+ },
138
+ }),
139
+ // eslint-disable-next-line react-hooks/exhaustive-deps
140
+ [viewId]
141
+ );
142
+
143
+ const warningEmitted = useRef(false);
144
+
145
+ useEffect(() => {
146
+ if (!options || !onChange || warningEmitted.current) {
147
+ return;
148
+ }
149
+ const subscribedEvents = options.subscribedEvents as string[] | undefined;
150
+
151
+ const invalidEvents = validateSubscribedEventStrings(subscribedEvents);
152
+ if (invalidEvents.length > 0) {
153
+ warningEmitted.current = true;
154
+ const warningPayload = makeUnknownEventWarningPayload(invalidEvents);
155
+ onChange({
156
+ eventName: 'UNKNOWN_EVENT_SUBSCRIBED',
157
+ payload: {
158
+ message: warningPayload.message,
159
+ invalidEvents: warningPayload.invalidEvents,
160
+ validEvents: warningPayload.validEvents,
161
+ },
162
+ });
163
+ }
164
+ }, [options, onChange]);
165
+
166
+ const onPaymentResultInternal = (event: nativeEvent) => {
167
+ onPaymentResult(parsePaymentResult(event.nativeEvent.result ?? ''));
168
+ };
169
+
170
+ const onPaymentEventInternal = (event: paymentEventNative) => {
171
+ onChange?.(event.nativeEvent);
172
+ };
173
+
174
+ return (
175
+ <NativePaymentWidgetImpl
176
+ ref={viewRef}
177
+ sdkAuthorization={paymentSessionConfig?.sdkAuthorization ?? ''}
178
+ widgetType="widgetPaymentSheet"
179
+ onPaymentEvent={onPaymentEventInternal}
180
+ onPaymentResult={onPaymentResultInternal}
181
+ options={{
182
+ hyperswitchConfig,
183
+ paymentSessionConfig,
184
+ configuration: options,
185
+ }}
186
+ style={style}
187
+ />
188
+ );
189
+ });