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,51 @@
1
+ import type { TurboModule } from 'react-native';
2
+ import { NativeModules, TurboModuleRegistry } from 'react-native';
3
+
4
+ export type CustomEndpoints = Object;
5
+
6
+ export interface SessionData {
7
+ hyperswitchConfig: Object;
8
+ paymentSessionConfig: { sdkAuthorization: string };
9
+ configuration: Object;
10
+ }
11
+
12
+ export interface SavedPaymentMethodsConfiguration {
13
+ hiddenPaymentMethods?: string[];
14
+ }
15
+
16
+ export interface Spec extends TurboModule {
17
+ initialise(
18
+ publishableKey: string,
19
+ platformPublishableKey: string,
20
+ profileId: string,
21
+ environment: string,
22
+ customEndpoints: CustomEndpoints
23
+ ): Promise<string>;
24
+
25
+ presentPaymentSheet(params: SessionData): Promise<string>;
26
+
27
+ getCustomerSavedPaymentMethods(params?: SessionData): Promise<string>;
28
+
29
+ getCustomerLastUsedPaymentMethodData(): Promise<string>;
30
+
31
+ getCustomerDefaultSavedPaymentMethodData(): Promise<string>;
32
+
33
+ getCustomerSavedPaymentMethodData(): Promise<string>;
34
+
35
+ confirmWithCustomerLastUsedPaymentMethod(reactTag: number): Promise<string>;
36
+
37
+ confirmWithCustomerDefaultPaymentMethod(reactTag: number): Promise<string>;
38
+
39
+ confirmWithCustomerPaymentToken(reactTag: number, token: string): Promise<string>;
40
+ }
41
+
42
+ /**
43
+ * Use `TurboModuleRegistry.get` first for new-arch TurboModules, and fall back
44
+ * to `NativeModules` for legacy/old-arch support.
45
+ */
46
+ const NativeHyperswitchModule =
47
+ TurboModuleRegistry.get<Spec>('NativeHyperswitchModule') ??
48
+ NativeModules.NativeHyperswitchModule;
49
+ console.log('NativeHyperswitchModule', NativeHyperswitchModule);
50
+ export default NativeHyperswitchModule as Spec;
51
+ export { NativeHyperswitchModule };
@@ -0,0 +1,62 @@
1
+ import type {TurboModule} from 'react-native';
2
+ import {TurboModuleRegistry} from 'react-native';
3
+
4
+ /**
5
+ * Codegen spec for the HyperModule TurboModule.
6
+ *
7
+ * Naming convention: Native<ModuleName>.ts — required by the RN codegen.
8
+ * All number params map to Double on Android (Kotlin) and NSNumber on iOS.
9
+ * All Object params map to ReadableMap; Array<Object> maps to ReadableArray.
10
+ */
11
+ export interface Spec extends TurboModule {
12
+ // --- EventEmitter (required for NativeEventEmitter support) ---
13
+ addListener(eventName: string): void;
14
+ removeListeners(count: number): void;
15
+
16
+ // --- Generic message passing ---
17
+ sendMessageToNative(message: string): void;
18
+
19
+ // --- Google Pay (Android) ---
20
+ launchGPay(requestObj: string, callback: (result: Object) => void): void;
21
+
22
+ // --- Apple Pay (iOS; stubs on Android) ---
23
+ launchApplePay(requestObj: string, callback: (result: Object) => void): void;
24
+ startApplePay(requestObj: string, callback: (result: Object) => void): void;
25
+ presentApplePay(requestObj: string, callback: (result: Object) => void): void;
26
+
27
+ // --- Payment sheet ---
28
+ exitPaymentsheet(rootTag: number, result: string, reset: boolean): void;
29
+ exitPaymentMethodManagement(rootTag: number, result: string, reset: boolean): void;
30
+
31
+ // --- Widget ---
32
+ exitWidget(result: string, widgetType: string): void;
33
+ exitCardForm(result: string): void;
34
+ launchWidgetPaymentSheet(
35
+ requestObj: string,
36
+ callback: (result: Object) => void,
37
+ ): void;
38
+ exitWidgetPaymentsheet(rootTag: number, result: string, reset: boolean): void;
39
+ updateWidgetHeight(height: number): void;
40
+ notifyWidgetPaymentResult(rootTag: number, result: string): void;
41
+
42
+ // --- Payment method management ---
43
+ onAddPaymentMethod(data: string): void;
44
+
45
+ // --- Payment events ---
46
+ emitPaymentEvent(rootTag: number, eventType: string, payload: Object): void;
47
+ onUpdateIntentEvent(rootTag: number, type: string, result: string): void;
48
+ onPaymentConfirmButtonClick(
49
+ rootTag: number,
50
+ payload: string,
51
+ callback: (shouldProceed: boolean) => void,
52
+ ): void;
53
+
54
+ // --- 3DS / DDC iframe bridge ---
55
+ openIframeBridge(
56
+ url: string,
57
+ timeoutMs: number,
58
+ callback: (result: string) => void,
59
+ ): void;
60
+ }
61
+
62
+ export default TurboModuleRegistry.get<Spec>('HyperModule');
@@ -0,0 +1,25 @@
1
+ import type { TurboModule } from 'react-native';
2
+ import { NativeModules, TurboModuleRegistry } from 'react-native';
3
+
4
+ export interface Spec extends TurboModule {
5
+ confirmPayment(
6
+ reactTag: number,
7
+ callback: (result: Object) => void
8
+ ): void;
9
+ updateIntentInitForWidget(
10
+ reactTag: number,
11
+ callback: (result: Object) => void
12
+ ): void;
13
+ updateIntentCompleteForWidget(
14
+ reactTag: number,
15
+ sdkAuthorization: string,
16
+ callback: (result: Object) => void
17
+ ): void;
18
+ }
19
+
20
+
21
+ const NativePaymentElementModule =
22
+ TurboModuleRegistry.get<Spec>('NativePaymentElementModule') ??
23
+ NativeModules.NativePaymentElementModule;
24
+
25
+ export default NativePaymentElementModule as Spec;
@@ -0,0 +1,21 @@
1
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
2
+ import type { ViewProps } from 'react-native';
3
+ import { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
4
+ import { UnsafeMixed, UnsafeObject } from './utils';
5
+ import type { options } from '../types/PaymentSheetConfiguration';
6
+
7
+
8
+ export interface NativeProps extends ViewProps {
9
+ widgetType?: string;
10
+ sdkAuthorization?: string;
11
+ options?: UnsafeMixed<options>;
12
+ onPaymentResult?: DirectEventHandler<{
13
+ result?: string;
14
+ }>;
15
+ onPaymentEvent?: DirectEventHandler<{
16
+ eventName: string;
17
+ payload?: UnsafeMixed<Record<string, any>>;
18
+ }>;
19
+ }
20
+
21
+ export default codegenNativeComponent<NativeProps>('RCTNativePaymentElement');
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Allows using types that codegen doesn't support, which will be generated
3
+ * as mixed, but keeping the TS type for type-checking.
4
+ *
5
+ * Note that for some reason this only works for native components, not for turbo modules.
6
+ */
7
+ export type UnsafeMixed<T> = T;
8
+
9
+ /**
10
+ * Allows using types that codegen doesn't support, which will be generated
11
+ * as object, but keeping the TS type for type-checking.
12
+ *
13
+ * Note that for some reason this only works for turbo modules, not for native components.
14
+ */
15
+ export type UnsafeObject<T> = T;
@@ -0,0 +1,73 @@
1
+ import type { ViewStyle } from 'react-native';
2
+ import type { PaymentSheetConfiguration } from './PaymentSheetConfiguration';
3
+ import {
4
+ HyperswitchConfiguration,
5
+ PaymentSessionConfiguration,
6
+ } from './definitions';
7
+
8
+ export type paymentResult = {
9
+ status?: string;
10
+ errorMessage?: string;
11
+ };
12
+
13
+ export type paymentResultEvent = paymentResult;
14
+
15
+ export type cardInfo = {
16
+ bin: string | undefined;
17
+ last4: string | undefined;
18
+ brand: string | undefined;
19
+ expiryMonth: string | undefined;
20
+ expiryYear: string | undefined;
21
+ formattedExpiry: string | undefined;
22
+ isCardNumberComplete: boolean;
23
+ isCvcComplete: boolean;
24
+ isExpiryComplete: boolean;
25
+ isCardNumberValid: boolean;
26
+ isExpiryValid: boolean;
27
+ };
28
+
29
+ export type paymentMethodStatusEvent = {
30
+ paymentMethod: string;
31
+ paymentMethodType: string;
32
+ isSavedPaymentMethod: boolean;
33
+ isOneClickWallet: boolean;
34
+ };
35
+
36
+ export type formStatusEvent = { status: string };
37
+
38
+ export type paymentMethodInfoAddress = {
39
+ country: string;
40
+ state: string;
41
+ postalCode: string;
42
+ };
43
+
44
+ export type cvcStatusEvent = {
45
+ isCvcFocused: boolean;
46
+ isCvcBlur: boolean;
47
+ isCvcEmpty: boolean;
48
+ };
49
+
50
+ export type paymentEventResult = {
51
+ eventName: string;
52
+ payload: Record<string, unknown>;
53
+ };
54
+
55
+ export type paymentEventNative = { nativeEvent: paymentEventResult };
56
+
57
+ export type paymentResultInternal = { result?: string };
58
+
59
+ export type nativeEvent = { nativeEvent: paymentResultInternal };
60
+
61
+ export type nativePaymentWidgetType = {
62
+ ref?: React.Ref<unknown>;
63
+ widgetType?: string;
64
+ sdkAuthorization?: string;
65
+ options?: {
66
+ hyperswitchConfig?: HyperswitchConfiguration;
67
+ paymentSessionConfig?: PaymentSessionConfiguration;
68
+ configuration?: PaymentSheetConfiguration;
69
+ };
70
+ onPaymentResult?: (event: nativeEvent) => void;
71
+ style?: ViewStyle;
72
+ onPaymentEvent?: (event: paymentEventNative) => void;
73
+ };
@@ -0,0 +1,360 @@
1
+ import { HyperswitchConfiguration } from "./definitions";
2
+
3
+ export interface Colors {
4
+ primary?: string;
5
+ background?: string;
6
+ componentBackground?: string;
7
+ componentBorder?: string;
8
+ componentDivider?: string;
9
+ componentText?: string;
10
+ primaryText?: string;
11
+ secondaryText?: string;
12
+ placeholderText?: string;
13
+ icon?: string;
14
+ error?: string;
15
+ loaderBackground?: string;
16
+ loaderForeground?: string;
17
+ overlay?: string;
18
+ selectedComponentBackground?: string;
19
+ selectedComponentBorder?: string;
20
+ selectedComponentBorderWidth?: number;
21
+ selectedComponentDivider?: string;
22
+ selectedComponentText?: string;
23
+ }
24
+
25
+ export interface ColorType {
26
+ light?: Colors;
27
+ dark?: Colors;
28
+ }
29
+
30
+ export interface OffsetType {
31
+ x?: number;
32
+ y?: number;
33
+ }
34
+
35
+ export interface ShadowConfig {
36
+ color?: string;
37
+ opacity?: number;
38
+ blurRadius?: number;
39
+ offset?: OffsetType;
40
+ intensity?: number;
41
+ }
42
+
43
+ export interface Shapes {
44
+ borderRadius?: number;
45
+ borderWidth?: number;
46
+ shadow?: ShadowConfig;
47
+ inputHeight?: number;
48
+ gap?: number;
49
+ }
50
+
51
+ export interface Font {
52
+ family?: string;
53
+ scale?: number;
54
+ headingTextSizeAdjust?: number;
55
+ subHeadingTextSizeAdjust?: number;
56
+ placeholderTextSizeAdjust?: number;
57
+ buttonTextSizeAdjust?: number;
58
+ errorTextSizeAdjust?: number;
59
+ linkTextSizeAdjust?: number;
60
+ modalTextSizeAdjust?: number;
61
+ cardTextSizeAdjust?: number;
62
+ }
63
+
64
+
65
+ export type SubscriptionEvent =
66
+ | 'PAYMENT_METHOD_INFO_CARD'
67
+ | 'PAYMENT_METHOD_STATUS'
68
+ | 'FORM_STATUS'
69
+ | 'PAYMENT_METHOD_INFO_BILLING_ADDRESS'
70
+ | 'CVC_STATUS';
71
+
72
+ export type Theme =
73
+ | 'Default'
74
+ | 'Light'
75
+ | 'Dark'
76
+ | 'Minimal'
77
+ | 'FlatMinimal'
78
+ | 'Brutal'
79
+ | 'Glass'
80
+ | 'Skeu'
81
+ | 'Clay'
82
+ | 'Charcoal'
83
+ | 'Soft';
84
+
85
+ export type LayoutType = 'tabs' | 'accordion' | 'spacedAccordion';
86
+ export type PaymentMethodsArrangement = 'default' | 'grid';
87
+ export type RedirectionInfo = 'hidden' | 'shown';
88
+ export type CvcIconDisplay = 'shown' | 'hidden';
89
+
90
+ export interface GroupingBehavior {
91
+ displayInSeparateScreen?: boolean;
92
+ displayInSeparateSection?: boolean;
93
+ groupByPaymentMethods?: boolean;
94
+ }
95
+
96
+ export interface SavedPaymentMethodsConfiguration {
97
+ hiddenPaymentMethods?: string[];
98
+ }
99
+
100
+ export interface SavedMethodCustomization {
101
+ defaultCollapsed?: boolean;
102
+ hideCardExpiry?: boolean;
103
+ hideCVCError?: boolean;
104
+ cvcIcon?: CvcIconDisplay;
105
+ groupingBehavior?: GroupingBehavior;
106
+ hiddenPaymentMethods?: string[];
107
+ }
108
+
109
+ export type CardBrandIconDisplay = 'hidden' | 'animated' | 'standard' | 'hideGeneric';
110
+
111
+ export interface PaymentMethodLayout {
112
+ type?: LayoutType;
113
+ showOneClickWalletsOnTop?: boolean;
114
+ paymentMethodsArrangementForTabs?: PaymentMethodsArrangement;
115
+ defaultCollapsed?: boolean;
116
+ radios?: boolean;
117
+ spacedAccordionItems?: boolean;
118
+ maxAccordionItems?: number;
119
+ cvcIcon?: CvcIconDisplay;
120
+ cardBrandIcon?: CardBrandIconDisplay;
121
+ showCheckedIconForSelection?: boolean;
122
+ savedMethodCustomization?: SavedMethodCustomization;
123
+ }
124
+
125
+ export interface PrimaryButtonColors {
126
+ background?: string;
127
+ text?: string;
128
+ border?: string;
129
+ }
130
+
131
+ export interface PrimaryButtonColorType {
132
+ light?: PrimaryButtonColors;
133
+ dark?: PrimaryButtonColors;
134
+ }
135
+
136
+ export interface PrimaryButton {
137
+ shapes?: Shapes;
138
+ colors?: PrimaryButtonColorType;
139
+ height?: number;
140
+ }
141
+
142
+ export type GooglePayButtonType =
143
+ | 'BUY'
144
+ | 'BOOK'
145
+ | 'CHECKOUT'
146
+ | 'DONATE'
147
+ | 'ORDER'
148
+ | 'PAY'
149
+ | 'SUBSCRIBE'
150
+ | 'PLAIN';
151
+
152
+ export type GooglePayButtonStyle = 'light' | 'dark';
153
+
154
+ export interface GooglePayThemeBaseStyle {
155
+ light?: GooglePayButtonStyle;
156
+ dark?: GooglePayButtonStyle;
157
+ }
158
+
159
+ export interface GooglePayConfiguration {
160
+ visibility?: 'hidden' | 'shown';
161
+ buttonType?: GooglePayButtonType;
162
+ buttonStyle?: GooglePayThemeBaseStyle;
163
+ }
164
+
165
+ export type ApplePayButtonType =
166
+ | 'buy'
167
+ | 'setUp'
168
+ | 'inStore'
169
+ | 'donate'
170
+ | 'checkout'
171
+ | 'book'
172
+ | 'subscribe'
173
+ | 'plain';
174
+
175
+ export type ApplePayButtonStyle = 'white' | 'whiteOutline' | 'black';
176
+
177
+ export interface ApplePayThemeBaseStyle {
178
+ light?: ApplePayButtonStyle;
179
+ dark?: ApplePayButtonStyle;
180
+ }
181
+
182
+ export interface ApplePayConfiguration {
183
+ visibility?: 'hidden' | 'shown';
184
+ buttonType?: ApplePayButtonType;
185
+ buttonStyle?: ApplePayThemeBaseStyle;
186
+ }
187
+
188
+ export type PayPalButtonType = 'paypal' | 'checkout' | 'buynow' | 'pay';
189
+ export type PayPalButtonStyle = 'gold' | 'blue' | 'white' | 'black' | 'silver';
190
+ export type PayPalButtonSize = 'small' | 'medium' | 'large';
191
+
192
+ export interface PayPalThemeBaseStyle {
193
+ light?: PayPalButtonStyle;
194
+ dark?: PayPalButtonStyle;
195
+ }
196
+
197
+ export interface PayPalConfiguration {
198
+ visibility?: 'hidden' | 'shown';
199
+ buttonType?: PayPalButtonType;
200
+ buttonSize?: PayPalButtonSize;
201
+ buttonStyle?: PayPalThemeBaseStyle;
202
+ }
203
+
204
+ export interface WalletButtonsConfiguration {
205
+ googlePay?: GooglePayConfiguration;
206
+ applePay?: ApplePayConfiguration;
207
+ payPal?: PayPalConfiguration;
208
+ }
209
+
210
+ export interface LogoColors {
211
+ backgroundColor?: string;
212
+ selected?: string;
213
+ unselected?: string;
214
+ }
215
+
216
+ export interface LogoColorType {
217
+ light?: LogoColors;
218
+ dark?: LogoColors;
219
+ }
220
+
221
+ export interface CheckedIconColors {
222
+ color?: string;
223
+ stroke?: string;
224
+ }
225
+
226
+ export interface CheckedIconColorType {
227
+ light?: CheckedIconColors;
228
+ dark?: CheckedIconColors;
229
+ }
230
+
231
+ export interface CheckedIconForSelection {
232
+ colors?: CheckedIconColorType;
233
+ size?: number;
234
+ bottom?: number;
235
+ right?: number;
236
+ }
237
+
238
+ export interface LogoCustomization {
239
+ borderRadius?: number;
240
+ colors?: LogoColorType;
241
+ checkedIconForSelection?: CheckedIconForSelection;
242
+ }
243
+
244
+ export interface Appearance {
245
+ theme?: Theme;
246
+ colors?: ColorType;
247
+ shapes?: Shapes;
248
+ font?: Font;
249
+ primaryButton?: PrimaryButton;
250
+ logo?: LogoCustomization;
251
+ }
252
+
253
+ export interface Placeholder {
254
+ cardNumber?: string;
255
+ expiryDate?: string;
256
+ cvv?: string;
257
+ }
258
+
259
+ export interface Address {
260
+ first_name?: string;
261
+ last_name?: string;
262
+ city?: string;
263
+ country?: string;
264
+ line1?: string;
265
+ line2?: string;
266
+ line3?: string;
267
+ postalCode?: string;
268
+ state?: string;
269
+ }
270
+
271
+ export interface Phone {
272
+ number?: string;
273
+ code?: string;
274
+ }
275
+
276
+ export interface AddressDetails {
277
+ address?: Address;
278
+ email?: string;
279
+ phone?: Phone;
280
+ }
281
+
282
+ export interface CustomerConfiguration {
283
+ id?: string;
284
+ ephemeralKeySecret?: string;
285
+ }
286
+
287
+ export interface PaymentMethodConfig {
288
+ paymentMethod: string;
289
+ message?: string;
290
+ }
291
+
292
+ export type Locale =
293
+ | 'en'
294
+ | 'he'
295
+ | 'fr'
296
+ | 'en-GB'
297
+ | 'ar'
298
+ | 'ja'
299
+ | 'de'
300
+ | 'fr-BE'
301
+ | 'es'
302
+ | 'ca'
303
+ | 'pt'
304
+ | 'it'
305
+ | 'pl'
306
+ | 'nl'
307
+ | 'nI-BE'
308
+ | 'sv'
309
+ | 'ru'
310
+ | 'lt'
311
+ | 'cs'
312
+ | 'sk'
313
+ | 'ls'
314
+ | 'cy'
315
+ | 'el'
316
+ | 'et'
317
+ | 'fi'
318
+ | 'nb'
319
+ | 'bs'
320
+ | 'da'
321
+ | 'ms'
322
+ | 'tr-CY';
323
+
324
+ export interface PaymentSheetConfiguration {
325
+ appearance?: Appearance;
326
+ merchantDisplayName: string;
327
+ allowsDelayedPaymentMethods?: boolean;
328
+ allowsPaymentMethodsRequiringShippingAddress?: boolean;
329
+ displaySavedPaymentMethodsCheckbox?: boolean;
330
+ displaySavedPaymentMethods?: boolean;
331
+ displayDefaultSavedPaymentIcon?: boolean;
332
+ displayPayButton?: boolean;
333
+ stickyPayButton?: boolean;
334
+ disableBranding?: boolean;
335
+ preloadCardElement?: boolean;
336
+ primaryButtonLabel?: string;
337
+ paymentSheetHeaderLabel?: string;
338
+ savedPaymentSheetHeaderLabel?: string;
339
+ netceteraSDKApiKey?: string;
340
+ locale?: Locale;
341
+ subscribedEvents?: SubscriptionEvent[];
342
+ customer?: CustomerConfiguration;
343
+ placeholder?: Placeholder;
344
+ billingDetails?: AddressDetails;
345
+ shippingDetails?: AddressDetails;
346
+ walletButtonsConfiguration?: WalletButtonsConfiguration;
347
+ redirectionInfo?: RedirectionInfo;
348
+ alwaysSendCustomerAcceptance?: boolean;
349
+ paymentMethodsConfig?: PaymentMethodConfig[];
350
+ opensCardScannerAutomatically?: boolean;
351
+ paymentMethodOrder?: string[];
352
+ paymentMethodLayout?: PaymentMethodLayout;
353
+ splitCardFields?: boolean;
354
+ }
355
+
356
+ export interface options {
357
+ hyperswitchConfig?: HyperswitchConfiguration;
358
+ paymentSessionConfig?: { sdkAuthorization: string };
359
+ configuration?: PaymentSheetConfiguration;
360
+ }