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,470 @@
1
+ //
2
+ // HyperswitchModule.swift
3
+ // Hyperswitch
4
+ //
5
+ // Created by Harshit Srivastava on 12/09/25.
6
+ //
7
+
8
+ import Foundation
9
+ import React
10
+
11
+ @objc(HyperswitchModule)
12
+ public class HyperswitchModule: NSObject {
13
+
14
+ @objc public static let shared: HyperswitchModule = HyperswitchModule()
15
+
16
+ // Instance handle -> Hyperswitch created with publishable key only.
17
+ private var instances = [String: Hyperswitch]()
18
+
19
+ private var activeHyperswitch: Hyperswitch?
20
+ private var activePublishableKey: String?
21
+ private var activeProfileId: String?
22
+ private var activePaymentSession: PaymentSession?
23
+ private var activePaymentSessionHandler: PaymentSessionHandler?
24
+ @objc internal static var isCvcWidgetActive: Bool = false
25
+
26
+ /// View-registry reference injected by HyperswitchSdkReactNative.mm so this singleton
27
+ /// can resolve native widget views by reactTag.
28
+ @objc public var viewRegistry_DEPRECATED: RCTViewRegistry?
29
+
30
+ @objc(initialiseWithPublishableKey:customBackendUrl:customLogUrl:customParams:resolve:reject:)
31
+ public func initialise(
32
+ publishableKey: String,
33
+ customBackendUrl: String?,
34
+ customLogUrl: String?,
35
+ customParams: [String: Any]?,
36
+ resolve: @escaping RCTPromiseResolveBlock,
37
+ reject: @escaping RCTPromiseRejectBlock
38
+ ) {
39
+ activePublishableKey = publishableKey
40
+ activeProfileId = customParams?["profileId"] as? String
41
+
42
+ let customEndpoints = CustomEndpointConfiguration.overrideEndpoints(
43
+ OverrideEndpointConfiguration(
44
+ customBackendEndpoint: customBackendUrl,
45
+ customLoggingEndpoint: customLogUrl
46
+ )
47
+ )
48
+ let hyperswitch = Hyperswitch(
49
+ configuration: HyperswitchConfiguration(
50
+ publishableKey: publishableKey,
51
+ profileId: activeProfileId,
52
+ customEndpoints: customEndpoints
53
+ )
54
+ )
55
+
56
+ let handle = UUID().uuidString
57
+ instances[handle] = hyperswitch
58
+
59
+ resolve(handle)
60
+ }
61
+
62
+ @objc(initPaymentSession:sdkAuthorization:resolve:reject:)
63
+ public func initPaymentSession(
64
+ instanceHandle: String,
65
+ sdkAuthorization: String,
66
+ resolve: @escaping RCTPromiseResolveBlock,
67
+ reject: @escaping RCTPromiseRejectBlock
68
+ ) {
69
+ guard let hyperswitch = instances[instanceHandle] else {
70
+ reject("INIT_ERROR", "Hyperswitch instance not found for handle: \(instanceHandle)", NSError(domain: "HyperswitchModule", code: 0))
71
+ return
72
+ }
73
+
74
+ activeHyperswitch = nil
75
+ activePaymentSession = nil
76
+ activePaymentSessionHandler = nil
77
+
78
+ let session = hyperswitch.initPaymentSession(
79
+ configuration: PaymentSessionConfiguration(sdkAuthorization: sdkAuthorization)
80
+ )
81
+
82
+ activeHyperswitch = hyperswitch
83
+ activePaymentSession = session
84
+ activePaymentSessionHandler = nil
85
+
86
+ resolve("active")
87
+ }
88
+
89
+ internal static func getActiveHyperswitch() -> Hyperswitch? {
90
+ return shared.activeHyperswitch
91
+ }
92
+
93
+ internal static func getActivePaymentSession() -> PaymentSession? {
94
+ return shared.activePaymentSession
95
+ }
96
+
97
+ internal static func getActivePublishableKey() -> String? {
98
+ return shared.activePublishableKey
99
+ }
100
+
101
+ internal static func getActiveProfileId() -> String? {
102
+ return shared.activeProfileId
103
+ }
104
+
105
+ @objc(presentPaymentSheet:resolve:reject:)
106
+ public func presentPaymentSheet(
107
+ configuration: [String: Any],
108
+ resolve: @escaping RCTPromiseResolveBlock,
109
+ reject: @escaping RCTPromiseRejectBlock
110
+ ) {
111
+ guard let session = activePaymentSession else {
112
+ reject("PRESENT_ERROR", "Payment session not initialized. Call initPaymentSession first.", NSError(domain: "HyperswitchModule", code: 0))
113
+ return
114
+ }
115
+
116
+ DispatchQueue.main.async {
117
+ guard let vc = RCTPresentedViewController() else {
118
+ reject("error", "Could not find presented view controller", NSError())
119
+ return
120
+ }
121
+ session.presentPaymentSheetWithParams(
122
+ viewController: vc,
123
+ params: configuration,
124
+ completion: { result in
125
+ switch result {
126
+ case .completed(let data):
127
+ resolve(["status": "completed", "message": data])
128
+ case .failed(let error as NSError):
129
+ resolve([
130
+ "status": "failed", "code": error.domain, "message": "Payment failed: \(error.userInfo["message"] ?? "Failed")",
131
+ ])
132
+ case .canceled(let data):
133
+ resolve(["status": "cancelled", "message": data])
134
+ }
135
+ }
136
+ )
137
+ }
138
+ }
139
+
140
+ // MARK: - Headless Payment Methods
141
+
142
+ @objc(getCustomerSavedPaymentMethods:resolve:reject:)
143
+ public func getCustomerSavedPaymentMethods(
144
+ options: [String: Any]?,
145
+ resolve: @escaping RCTPromiseResolveBlock,
146
+ reject: @escaping RCTPromiseRejectBlock
147
+ ) {
148
+ guard let session = activePaymentSession else {
149
+ resolve([
150
+ "status": "error",
151
+ "code": "NO_SESSION",
152
+ "message": "Payment session not initialized. Call initPaymentSession first.",
153
+ ])
154
+ return
155
+ }
156
+
157
+ session.getCustomerSavedPaymentMethods { [weak self] handler in
158
+ self?.activePaymentSessionHandler = handler
159
+ resolve(["status": "success", "message": "Payment methods initialized"])
160
+ }
161
+ }
162
+
163
+ @objc(getCustomerDefaultSavedPaymentMethodDataWithResolve:reject:)
164
+ public func getCustomerDefaultSavedPaymentMethodData(
165
+ resolve: @escaping RCTPromiseResolveBlock,
166
+ reject: @escaping RCTPromiseRejectBlock
167
+ ) {
168
+ guard let handler = activePaymentSessionHandler else {
169
+ resolve([
170
+ "status": "error",
171
+ "message": "Payment session handler not initialized.",
172
+ ])
173
+ return
174
+ }
175
+
176
+ let result = handler.getCustomerDefaultSavedPaymentMethodData()
177
+ switch result {
178
+ case .success(let paymentMethod):
179
+ if let jsonData = try? JSONEncoder().encode(paymentMethod),
180
+ let jsonDict = try? JSONSerialization.jsonObject(with: jsonData) as? [String: Any]
181
+ {
182
+ resolve([
183
+ "status": "success",
184
+ "message": "Default payment method retrieved",
185
+ "data": jsonDict,
186
+ ])
187
+ } else {
188
+ resolve([
189
+ "status": "error",
190
+ "code": "ENCODE_ERROR",
191
+ "message": "Failed to encode payment method data",
192
+ ])
193
+ }
194
+ case .failure(let error):
195
+ resolve([
196
+ "status": "failed",
197
+ "code": error.code,
198
+ "message": error.message,
199
+ ])
200
+ }
201
+ }
202
+
203
+ @objc(getCustomerLastUsedPaymentMethodDataWithResolve:reject:)
204
+ public func getCustomerLastUsedPaymentMethodData(
205
+ resolve: @escaping RCTPromiseResolveBlock,
206
+ reject: @escaping RCTPromiseRejectBlock
207
+ ) {
208
+ guard let handler = activePaymentSessionHandler else {
209
+ resolve([
210
+ "status": "error",
211
+ "message": "Payment session handler not initialized.",
212
+ ])
213
+ return
214
+ }
215
+
216
+ let result = handler.getCustomerLastUsedPaymentMethodData()
217
+ switch result {
218
+ case .success(let paymentMethod):
219
+ if let jsonData = try? JSONEncoder().encode(paymentMethod),
220
+ let jsonDict = try? JSONSerialization.jsonObject(with: jsonData) as? [String: Any]
221
+ {
222
+ resolve([
223
+ "status": "success",
224
+ "message": "Last used payment method retrieved",
225
+ "data": jsonDict,
226
+ ])
227
+ } else {
228
+ resolve([
229
+ "status": "error",
230
+ "code": "ENCODE_ERROR",
231
+ "message": "Failed to encode payment method",
232
+ ])
233
+ }
234
+ case .failure(let error):
235
+ resolve([
236
+ "status": "failed",
237
+ "code": error.code,
238
+ "message": error.message,
239
+ ])
240
+ }
241
+ }
242
+
243
+ @objc(confirmWithCustomerDefaultPaymentMethod:resolve:reject:)
244
+ public func confirmWithCustomerDefaultPaymentMethod(
245
+ cvcWidgetReactTag: String?,
246
+ resolve: @escaping RCTPromiseResolveBlock,
247
+ reject: @escaping RCTPromiseRejectBlock
248
+ ) {
249
+ guard let handler = activePaymentSessionHandler else {
250
+ resolve([
251
+ "status": "error",
252
+ "message": "Payment session handler not initialized.",
253
+ ])
254
+ return
255
+ }
256
+
257
+ let reactTag = Int(cvcWidgetReactTag ?? "") ?? 0
258
+
259
+ if reactTag > 0 {
260
+ // CvcWidget reactTag provided — route through the native widget view
261
+ // so we can use the inner RCTRootView tag (widgetReactTag).
262
+ let result = handler.getCustomerDefaultSavedPaymentMethodData()
263
+ switch result {
264
+ case .success(let paymentMethod):
265
+ if paymentMethod.requiresCvv && paymentMethod.paymentMethod == "card" {
266
+ self.withNativePaymentWidgetView(
267
+ NSNumber(value: reactTag),
268
+ onFound: { view in
269
+ view.confirmCVCPayment(
270
+ paymentToken: paymentMethod.paymentToken,
271
+ paymentMethodId: paymentMethod.paymentMethodId,
272
+ resolve: resolve
273
+ )
274
+ },
275
+ onMissing: {
276
+ resolve([
277
+ "status": "failed",
278
+ "code": "WIDGET_NOT_FOUND",
279
+ "message": "CVC widget view not found for reactTag \(reactTag)",
280
+ ])
281
+ }
282
+ )
283
+ } else {
284
+ // Not a card or requiresCvv is false — bypass CvcWidget, confirm directly with cvc = nil
285
+ handler.confirmWithCustomerDefaultPaymentMethod { result in
286
+ resolve(HyperswitchModule.paymentResultToDict(result))
287
+ }
288
+ }
289
+ case .failure(let error):
290
+ resolve([
291
+ "status": "failed",
292
+ "code": error.code,
293
+ "message": error.message,
294
+ ])
295
+ }
296
+ } else {
297
+ // No CvcWidget — confirm through HeadlessTask callback (cvc will be nil)
298
+ handler.confirmWithCustomerDefaultPaymentMethod { result in
299
+ resolve(HyperswitchModule.paymentResultToDict(result))
300
+ }
301
+ }
302
+ }
303
+
304
+ @objc(confirmWithCustomerLastUsedPaymentMethod:resolve:reject:)
305
+ public func confirmWithCustomerLastUsedPaymentMethod(
306
+ cvcWidgetReactTag: String?,
307
+ resolve: @escaping RCTPromiseResolveBlock,
308
+ reject: @escaping RCTPromiseRejectBlock
309
+ ) {
310
+ guard let handler = activePaymentSessionHandler else {
311
+ resolve([
312
+ "status": "error",
313
+ "message": "Payment session handler not initialized.",
314
+ ])
315
+ return
316
+ }
317
+
318
+ let reactTag = Int(cvcWidgetReactTag ?? "") ?? 0
319
+
320
+ if reactTag > 0 {
321
+ // CvcWidget reactTag provided — route through the native widget view
322
+ // so we can use the inner RCTRootView tag (widgetReactTag).
323
+ let result = handler.getCustomerLastUsedPaymentMethodData()
324
+ switch result {
325
+ case .success(let paymentMethod):
326
+ if paymentMethod.requiresCvv && paymentMethod.paymentMethod == "card" {
327
+ self.withNativePaymentWidgetView(
328
+ NSNumber(value: reactTag),
329
+ onFound: { view in
330
+ guard let cvcWidget = view.cvcWidgetRef else {
331
+ resolve([
332
+ "status": "failed",
333
+ "code": "WIDGET_NOT_READY",
334
+ "message": "CVC widget is not ready",
335
+ ])
336
+ return
337
+ }
338
+ handler.confirmWithCustomerLastUsedPaymentMethod(cvcWidget) { result in
339
+ resolve(HyperswitchModule.paymentResultToDict(result))
340
+ }
341
+ },
342
+ onMissing: {
343
+ resolve([
344
+ "status": "failed",
345
+ "code": "WIDGET_NOT_FOUND",
346
+ "message": "CVC widget view not found for reactTag \(reactTag)",
347
+ ])
348
+ }
349
+ )
350
+ } else {
351
+ // Not a card or requiresCvv is false — bypass CvcWidget, confirm directly with cvc = nil
352
+ resolve([
353
+ "status": "failed",
354
+ "code": "CVC_WIDGET_REQUIRED",
355
+ "message": "CVC widget is required to confirm the last used card payment method",
356
+ ])
357
+ }
358
+ case .failure(let error):
359
+ resolve([
360
+ "status": "failed",
361
+ "code": error.code,
362
+ "message": error.message,
363
+ ])
364
+ }
365
+ } else {
366
+ resolve([
367
+ "status": "failed",
368
+ "code": "CVC_WIDGET_REQUIRED",
369
+ "message": "CVC widget is required to confirm the last used payment method",
370
+ ])
371
+ }
372
+ }
373
+
374
+ @objc(confirmWithCustomerPaymentToken:resolve:reject:)
375
+ public func confirmWithCustomerPaymentToken(
376
+ paymentToken: String,
377
+ resolve: @escaping RCTPromiseResolveBlock,
378
+ reject: @escaping RCTPromiseRejectBlock
379
+ ) {
380
+ guard let handler = activePaymentSessionHandler else {
381
+ resolve([
382
+ "status": "error",
383
+ "message": "Payment session handler not initialized.",
384
+ ])
385
+ return
386
+ }
387
+
388
+ handler.confirmWithCustomerPaymentToken(paymentToken: paymentToken) { result in
389
+ resolve(HyperswitchModule.paymentResultToDict(result))
390
+ }
391
+ }
392
+
393
+ @objc(updateIntent:resolve:reject:)
394
+ public func updateIntent(
395
+ sdkAuthorization: String,
396
+ resolve: @escaping RCTPromiseResolveBlock,
397
+ reject: @escaping RCTPromiseRejectBlock
398
+ ) {
399
+ guard let session = activePaymentSession else {
400
+ reject("UPDATE_INTENT_ERROR", "Payment session not initialized. Call initPaymentSession first.", NSError(domain: "HyperswitchModule", code: 0))
401
+ return
402
+ }
403
+
404
+ session.updateIntent(
405
+ authorizationProvider: { completion in
406
+ completion(sdkAuthorization)
407
+ },
408
+ completion: { result in
409
+ switch result {
410
+ case .success:
411
+ resolve(["status": "success", "message": "Payment intent updated"])
412
+ case .cancelled:
413
+ resolve(["status": "cancelled", "message": "Payment intent update cancelled"])
414
+ case .failure(let error as NSError):
415
+ reject(error.domain, error.userInfo[NSLocalizedDescriptionKey] as? String ?? "Payment intent update failed", error)
416
+ }
417
+ }
418
+ )
419
+ }
420
+
421
+ // MARK: - CvcWidget View Lookup
422
+
423
+ /// Looks up the NativePaymentWidgetView for the supplied React tag by walking up the view
424
+ /// hierarchy, mirroring the approach used in HyperModule. Calls `onFound` when the widget
425
+ /// wrapper is located, otherwise `onMissing`.
426
+ private func withNativePaymentWidgetView(
427
+ _ reactTag: NSNumber,
428
+ onFound: @escaping (NativePaymentWidgetView) -> Void,
429
+ onMissing: @escaping () -> Void
430
+ ) {
431
+ guard let viewRegistry = self.viewRegistry_DEPRECATED else {
432
+ onMissing()
433
+ return
434
+ }
435
+ let view = viewRegistry.view(forReactTag: reactTag)
436
+ var current: UIView? = view
437
+ while let v = current {
438
+ if let nativeWidget = v as? NativePaymentWidgetView {
439
+ onFound(nativeWidget)
440
+ return
441
+ }
442
+ current = v.superview
443
+ }
444
+ onMissing()
445
+ }
446
+
447
+ /// Convert a PaymentResult to a dictionary suitable for RCTPromiseResolveBlock.
448
+ private static func paymentResultToDict(_ result: PaymentResult) -> [String: Any] {
449
+ switch result {
450
+ case .completed(let data):
451
+ return [
452
+ "status": "success",
453
+ "message": "Payment confirmed successfully",
454
+ "data": data,
455
+ ]
456
+ case .failed(let error as NSError):
457
+ return [
458
+ "status": "failed",
459
+ "code": error.domain,
460
+ "message": error.userInfo["message"] as? String ?? "Payment confirmation failed",
461
+ ]
462
+ case .canceled(let data):
463
+ return [
464
+ "status": "cancelled",
465
+ "message": "Payment confirmation cancelled",
466
+ "data": data,
467
+ ]
468
+ }
469
+ }
470
+ }
@@ -0,0 +1,5 @@
1
+ #import <HyperswitchSdkReactNativeSpec/HyperswitchSdkReactNativeSpec.h>
2
+
3
+ @interface HyperswitchSdkReactNative : NSObject <NativeHyperswitchSdkReactNativeSpec>
4
+
5
+ @end
@@ -0,0 +1,121 @@
1
+ #import "HyperswitchSdkReactNative.h"
2
+ #import <React/RCTComponent.h>
3
+ #import <memory>
4
+ #if __has_include("HyperswitchSdkReactNative-Swift.h")
5
+ #import "HyperswitchSdkReactNative-Swift.h"
6
+ #else
7
+ // When using use_frameworks! :linkage => :static in Podfile
8
+ #import <HyperswitchSdkReactNative/HyperswitchSdkReactNative-Swift.h>
9
+ #endif
10
+
11
+
12
+ @implementation HyperswitchSdkReactNative
13
+
14
+ @synthesize viewRegistry_DEPRECATED = _viewRegistry_DEPRECATED;
15
+
16
+ RCT_EXPORT_MODULE()
17
+
18
+ RCT_EXPORT_METHOD(initialise:(nonnull NSDictionary *)config
19
+ resolve:(nonnull RCTPromiseResolveBlock)resolve
20
+ reject:(nonnull RCTPromiseRejectBlock)reject) {
21
+ NSString *publishableKey = [config[@"publishableKey"] isKindOfClass:NSString.class] ? config[@"publishableKey"] : nil;
22
+ NSString *profileId = [config[@"profileId"] isKindOfClass:NSString.class] ? config[@"profileId"] : nil;
23
+ NSDictionary *customEndpoints = [config[@"customEndpoints"] isKindOfClass:NSDictionary.class] ? config[@"customEndpoints"] : nil;
24
+ NSDictionary *overrideEndpoints = [customEndpoints[@"overrideEndpoints"] isKindOfClass:NSDictionary.class] ? customEndpoints[@"overrideEndpoints"] : nil;
25
+ NSString *customBackendUrl = [overrideEndpoints[@"customBackendEndpoint"] isKindOfClass:NSString.class] ? overrideEndpoints[@"customBackendEndpoint"] : nil;
26
+ NSString *customLogUrl = [overrideEndpoints[@"customLoggingEndpoint"] isKindOfClass:NSString.class] ? overrideEndpoints[@"customLoggingEndpoint"] : nil;
27
+
28
+ NSMutableDictionary *customParams = [NSMutableDictionary dictionary];
29
+ if (profileId != nil) {
30
+ customParams[@"profileId"] = profileId;
31
+ }
32
+
33
+ [[self hyperswitchModule] initialiseWithPublishableKey:publishableKey customBackendUrl:customBackendUrl customLogUrl:customLogUrl customParams:customParams resolve:resolve reject:reject];
34
+ }
35
+
36
+ RCT_EXPORT_METHOD(initPaymentSession:(nonnull NSString *)instanceHandle
37
+ sdkAuthorization:(nonnull NSString *)sdkAuthorization
38
+ resolve:(nonnull RCTPromiseResolveBlock)resolve
39
+ reject:(nonnull RCTPromiseRejectBlock)reject) {
40
+ [[self hyperswitchModule] initPaymentSession:instanceHandle sdkAuthorization:sdkAuthorization resolve:resolve reject:reject];
41
+ }
42
+
43
+ RCT_EXPORT_METHOD(presentPaymentSheet:(nonnull NSDictionary *)configuration
44
+ resolve:(nonnull RCTPromiseResolveBlock)resolve
45
+ reject:(nonnull RCTPromiseRejectBlock)reject)
46
+ {
47
+ [[self hyperswitchModule] presentPaymentSheet:configuration resolve:resolve reject:reject];
48
+ }
49
+
50
+ #pragma mark - Headless Payment Methods
51
+
52
+ RCT_EXPORT_METHOD(getCustomerSavedPaymentMethods:(nullable NSDictionary *)options
53
+ resolve:(RCTPromiseResolveBlock)resolve
54
+ reject:(RCTPromiseRejectBlock)reject)
55
+ {
56
+ [[self hyperswitchModule] getCustomerSavedPaymentMethods:options resolve:resolve reject:reject];
57
+ }
58
+
59
+ RCT_EXPORT_METHOD(getCustomerDefaultSavedPaymentMethodData:(RCTPromiseResolveBlock)resolve
60
+ reject:(RCTPromiseRejectBlock)reject)
61
+ {
62
+ [[self hyperswitchModule] getCustomerDefaultSavedPaymentMethodDataWithResolve:resolve reject:reject];
63
+ }
64
+
65
+ RCT_EXPORT_METHOD(getCustomerLastUsedPaymentMethodData:(RCTPromiseResolveBlock)resolve
66
+ reject:(RCTPromiseRejectBlock)reject)
67
+ {
68
+ [[self hyperswitchModule] getCustomerLastUsedPaymentMethodDataWithResolve:resolve reject:reject];
69
+ }
70
+
71
+ RCT_EXPORT_METHOD(confirmWithCustomerDefaultPaymentMethod:(nullable NSString *)cvcWidgetReactTag
72
+ resolve:(RCTPromiseResolveBlock)resolve
73
+ reject:(RCTPromiseRejectBlock)reject)
74
+ {
75
+ [[self hyperswitchModule] confirmWithCustomerDefaultPaymentMethod:cvcWidgetReactTag resolve:resolve reject:reject];
76
+ }
77
+
78
+ RCT_EXPORT_METHOD(confirmWithCustomerLastUsedPaymentMethod:(nullable NSString *)cvcWidgetReactTag
79
+ resolve:(RCTPromiseResolveBlock)resolve
80
+ reject:(RCTPromiseRejectBlock)reject)
81
+ {
82
+ [[self hyperswitchModule] confirmWithCustomerLastUsedPaymentMethod:cvcWidgetReactTag resolve:resolve reject:reject];
83
+ }
84
+
85
+ RCT_EXPORT_METHOD(confirmWithCustomerPaymentToken:(nonnull NSString *)paymentToken
86
+ resolve:(RCTPromiseResolveBlock)resolve
87
+ reject:(RCTPromiseRejectBlock)reject)
88
+ {
89
+ [[self hyperswitchModule] confirmWithCustomerPaymentToken:paymentToken resolve:resolve reject:reject];
90
+ }
91
+
92
+ RCT_EXPORT_METHOD(updateIntent:(nonnull NSString *)sdkAuthorization
93
+ resolve:(RCTPromiseResolveBlock)resolve
94
+ reject:(RCTPromiseRejectBlock)reject)
95
+ {
96
+ [[self hyperswitchModule] updateIntent:sdkAuthorization resolve:resolve reject:reject];
97
+ }
98
+
99
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
100
+ (const facebook::react::ObjCTurboModule::InitParams &)params
101
+ {
102
+ return std::make_shared<facebook::react::NativeHyperswitchSdkReactNativeSpecJSI>(params);
103
+ }
104
+
105
+ + (BOOL)requiresMainQueueSetup
106
+ {
107
+ return YES;
108
+ }
109
+
110
+ - (dispatch_queue_t)methodQueue
111
+ {
112
+ return dispatch_get_main_queue();
113
+ }
114
+
115
+ - (HyperswitchModule *)hyperswitchModule
116
+ {
117
+ HyperswitchModule.shared.viewRegistry_DEPRECATED = self.viewRegistry_DEPRECATED;
118
+ return HyperswitchModule.shared;
119
+ }
120
+
121
+ @end
@@ -0,0 +1,18 @@
1
+ #import <HyperswitchSdkReactNativeSpec/HyperswitchSdkReactNativeSpec.h>
2
+
3
+ /**
4
+ * iOS TurboModule / legacy bridge implementation for the NativeHyperswitchModule spec.
5
+ *
6
+ * Matches the Android ReactNativeHyperswitchModule API exactly:
7
+ * • initialise(publishableKey, platformPublishableKey, profileId, environment, customEndpoints)
8
+ * • presentPaymentSheet(params)
9
+ * • getCustomerSavedPaymentMethods(params?)
10
+ * • getCustomerLastUsedPaymentMethodData()
11
+ * • getCustomerDefaultSavedPaymentMethodData()
12
+ * • getCustomerSavedPaymentMethodData() ← new
13
+ * • confirmWithCustomerLastUsedPaymentMethod() ← no cvcWidgetReactTag
14
+ * • confirmWithCustomerDefaultPaymentMethod() ← no cvcWidgetReactTag
15
+ */
16
+ @interface NativeHyperswitchModule : NSObject <NativeHyperswitchModuleSpec>
17
+
18
+ @end