@juspay-tech/react-native-hyperswitch 0.2.1 → 0.3.0

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 (183) hide show
  1. package/android/build.gradle +4 -10
  2. package/android/src/main/AndroidManifest.xml +0 -19
  3. package/android/src/main/assets/hyperswitch.bundle +172 -162
  4. package/android/src/main/java/com/hyperswitchsdkreactnative/internal/ReactFragment.kt +35 -1
  5. package/android/src/main/java/com/hyperswitchsdkreactnative/modules/HyperswitchSdkNativeModule.kt +30 -6
  6. package/android/src/main/java/com/hyperswitchsdkreactnative/provider/HyperProvider.kt +3 -2
  7. package/ios/hyperswitchSDK/Core/NativeModule/OTAServices.swift +1 -1
  8. package/ios/hyperswitchSDK/Core/Resources/hyperswitch.bundle +172 -162
  9. package/lib/bs/src/context/HyperProvider-JuspayTechReactNativeHyperswitch.cmt +0 -0
  10. package/lib/bs/src/hooks/useHyper-JuspayTechReactNativeHyperswitch.cmt +0 -0
  11. package/lib/bs/src/modules/NativeHyperswitchSdk-JuspayTechReactNativeHyperswitch.cmt +0 -0
  12. package/lib/bs/src/types/PaymentSheetConfiguration-JuspayTechReactNativeHyperswitch.cmt +0 -0
  13. package/lib/commonjs/index.bundle.js +11 -0
  14. package/lib/commonjs/index.bundle.js.map +1 -0
  15. package/lib/module/index.bundle.js +11 -0
  16. package/lib/module/index.bundle.js.map +1 -0
  17. package/lib/typescript/{commonjs/babel.config.d.ts.map → babel.config.d.ts.map} +1 -1
  18. package/lib/typescript/{commonjs/eslint.config.d.mts.map → eslint.config.d.mts.map} +1 -1
  19. package/lib/typescript/rollup.config.d.ts +23 -0
  20. package/lib/typescript/rollup.config.d.ts.map +1 -0
  21. package/lib/typescript/{commonjs/scripts → scripts}/bootstrap.d.ts.map +1 -1
  22. package/lib/typescript/src/context/HyperProvider.gen.d.ts.map +1 -0
  23. package/lib/typescript/src/context/HyperProvider.res.d.ts.map +1 -0
  24. package/lib/typescript/src/hooks/useHyper.gen.d.ts.map +1 -0
  25. package/lib/typescript/src/hooks/useHyper.res.d.ts.map +1 -0
  26. package/lib/typescript/src/index.d.ts.map +1 -0
  27. package/lib/typescript/src/modules/NativeHyperswitchSdk.gen.d.ts.map +1 -0
  28. package/lib/typescript/src/modules/NativeHyperswitchSdk.res.d.ts.map +1 -0
  29. package/lib/typescript/src/shims/Js.shim.d.ts.map +1 -0
  30. package/lib/typescript/src/specs/ApplePayButtonNativeComponent.d.ts.map +1 -0
  31. package/lib/typescript/src/specs/GooglePayButtonNativeComponent.android.d.ts.map +1 -0
  32. package/lib/typescript/src/specs/HyperswitchSdkReactNativeViewNativeComponent.d.ts.map +1 -0
  33. package/lib/typescript/src/specs/NativeHyperswitchSdkNative.d.ts.map +1 -0
  34. package/lib/typescript/src/specs/NativeHyperswitchSdkReactNative.d.ts.map +1 -0
  35. package/lib/typescript/src/types/PaymentSheetConfiguration.gen.d.ts.map +1 -0
  36. package/lib/typescript/src/types/PaymentSheetConfiguration.res.d.ts.map +1 -0
  37. package/package.json +27 -27
  38. package/rescript.json +31 -0
  39. package/tsconfig.build.json +20 -0
  40. package/android/src/main/java/com/hyperswitchsdkreactnative/activity/RedirectActivity.kt +0 -39
  41. package/android/src/main/java/io/hyperswitch/logs/CrashHandler.kt +0 -29
  42. package/android/src/main/java/io/hyperswitch/logs/Debouncer.kt +0 -20
  43. package/android/src/main/java/io/hyperswitch/logs/HyperLogManager.kt +0 -113
  44. package/android/src/main/java/io/hyperswitch/logs/LogData.kt +0 -159
  45. package/android/src/main/java/io/hyperswitch/logs/LogFileManager.kt +0 -60
  46. package/android/src/main/java/io/hyperswitch/networking/HyperNetworking.kt +0 -73
  47. package/lib/commonjs/context/HyperProvider.gen.js +0 -16
  48. package/lib/commonjs/context/HyperProvider.gen.js.map +0 -1
  49. package/lib/commonjs/context/HyperProvider.res +0 -78
  50. package/lib/commonjs/context/HyperProvider.res.js +0 -98
  51. package/lib/commonjs/context/HyperProvider.res.js.map +0 -1
  52. package/lib/commonjs/hooks/useHyper.gen.js +0 -15
  53. package/lib/commonjs/hooks/useHyper.gen.js.map +0 -1
  54. package/lib/commonjs/hooks/useHyper.res +0 -142
  55. package/lib/commonjs/hooks/useHyper.res.js +0 -152
  56. package/lib/commonjs/hooks/useHyper.res.js.map +0 -1
  57. package/lib/commonjs/index.js +0 -26
  58. package/lib/commonjs/index.js.map +0 -1
  59. package/lib/commonjs/modules/NativeHyperswitchSdk.gen.js +0 -6
  60. package/lib/commonjs/modules/NativeHyperswitchSdk.gen.js.map +0 -1
  61. package/lib/commonjs/modules/NativeHyperswitchSdk.res +0 -55
  62. package/lib/commonjs/modules/NativeHyperswitchSdk.res.js +0 -14
  63. package/lib/commonjs/modules/NativeHyperswitchSdk.res.js.map +0 -1
  64. package/lib/commonjs/package.json +0 -1
  65. package/lib/commonjs/shims/Js.shim.js +0 -2
  66. package/lib/commonjs/shims/Js.shim.js.map +0 -1
  67. package/lib/commonjs/specs/ApplePayButtonNativeComponent.ts +0 -11
  68. package/lib/commonjs/specs/GooglePayButtonNativeComponent.android.js +0 -10
  69. package/lib/commonjs/specs/GooglePayButtonNativeComponent.android.js.map +0 -1
  70. package/lib/commonjs/specs/HyperswitchSdkReactNativeViewNativeComponent.ts +0 -10
  71. package/lib/commonjs/specs/NativeHyperswitchSdkNative.js +0 -9
  72. package/lib/commonjs/specs/NativeHyperswitchSdkNative.js.map +0 -1
  73. package/lib/commonjs/specs/NativeHyperswitchSdkReactNative.js +0 -9
  74. package/lib/commonjs/specs/NativeHyperswitchSdkReactNative.js.map +0 -1
  75. package/lib/commonjs/types/PaymentSheetConfiguration.gen.js +0 -2
  76. package/lib/commonjs/types/PaymentSheetConfiguration.gen.js.map +0 -1
  77. package/lib/commonjs/types/PaymentSheetConfiguration.res +0 -215
  78. package/lib/commonjs/types/PaymentSheetConfiguration.res.js +0 -4
  79. package/lib/commonjs/types/PaymentSheetConfiguration.res.js.map +0 -1
  80. package/lib/module/context/HyperProvider.gen.js +0 -11
  81. package/lib/module/context/HyperProvider.gen.js.map +0 -1
  82. package/lib/module/context/HyperProvider.res +0 -78
  83. package/lib/module/context/HyperProvider.res.js +0 -91
  84. package/lib/module/context/HyperProvider.res.js.map +0 -1
  85. package/lib/module/hooks/useHyper.gen.js +0 -10
  86. package/lib/module/hooks/useHyper.gen.js.map +0 -1
  87. package/lib/module/hooks/useHyper.res +0 -142
  88. package/lib/module/hooks/useHyper.res.js +0 -142
  89. package/lib/module/hooks/useHyper.res.js.map +0 -1
  90. package/lib/module/index.js +0 -5
  91. package/lib/module/index.js.map +0 -1
  92. package/lib/module/modules/NativeHyperswitchSdk.gen.js +0 -4
  93. package/lib/module/modules/NativeHyperswitchSdk.gen.js.map +0 -1
  94. package/lib/module/modules/NativeHyperswitchSdk.res +0 -55
  95. package/lib/module/modules/NativeHyperswitchSdk.res.js +0 -9
  96. package/lib/module/modules/NativeHyperswitchSdk.res.js.map +0 -1
  97. package/lib/module/package.json +0 -1
  98. package/lib/module/shims/Js.shim.js +0 -2
  99. package/lib/module/shims/Js.shim.js.map +0 -1
  100. package/lib/module/specs/ApplePayButtonNativeComponent.ts +0 -11
  101. package/lib/module/specs/GooglePayButtonNativeComponent.android.js +0 -5
  102. package/lib/module/specs/GooglePayButtonNativeComponent.android.js.map +0 -1
  103. package/lib/module/specs/HyperswitchSdkReactNativeViewNativeComponent.ts +0 -10
  104. package/lib/module/specs/NativeHyperswitchSdkNative.js +0 -5
  105. package/lib/module/specs/NativeHyperswitchSdkNative.js.map +0 -1
  106. package/lib/module/specs/NativeHyperswitchSdkReactNative.js +0 -5
  107. package/lib/module/specs/NativeHyperswitchSdkReactNative.js.map +0 -1
  108. package/lib/module/types/PaymentSheetConfiguration.gen.js +0 -2
  109. package/lib/module/types/PaymentSheetConfiguration.gen.js.map +0 -1
  110. package/lib/module/types/PaymentSheetConfiguration.res +0 -215
  111. package/lib/module/types/PaymentSheetConfiguration.res.js +0 -4
  112. package/lib/module/types/PaymentSheetConfiguration.res.js.map +0 -1
  113. package/lib/typescript/commonjs/package.json +0 -1
  114. package/lib/typescript/commonjs/src/context/HyperProvider.gen.d.ts.map +0 -1
  115. package/lib/typescript/commonjs/src/context/HyperProvider.res.d.ts.map +0 -1
  116. package/lib/typescript/commonjs/src/hooks/useHyper.gen.d.ts.map +0 -1
  117. package/lib/typescript/commonjs/src/hooks/useHyper.res.d.ts.map +0 -1
  118. package/lib/typescript/commonjs/src/index.d.ts.map +0 -1
  119. package/lib/typescript/commonjs/src/modules/NativeHyperswitchSdk.gen.d.ts.map +0 -1
  120. package/lib/typescript/commonjs/src/modules/NativeHyperswitchSdk.res.d.ts.map +0 -1
  121. package/lib/typescript/commonjs/src/shims/Js.shim.d.ts.map +0 -1
  122. package/lib/typescript/commonjs/src/specs/ApplePayButtonNativeComponent.d.ts.map +0 -1
  123. package/lib/typescript/commonjs/src/specs/GooglePayButtonNativeComponent.android.d.ts.map +0 -1
  124. package/lib/typescript/commonjs/src/specs/HyperswitchSdkReactNativeViewNativeComponent.d.ts.map +0 -1
  125. package/lib/typescript/commonjs/src/specs/NativeHyperswitchSdkNative.d.ts.map +0 -1
  126. package/lib/typescript/commonjs/src/specs/NativeHyperswitchSdkReactNative.d.ts.map +0 -1
  127. package/lib/typescript/commonjs/src/types/PaymentSheetConfiguration.gen.d.ts.map +0 -1
  128. package/lib/typescript/commonjs/src/types/PaymentSheetConfiguration.res.d.ts.map +0 -1
  129. package/lib/typescript/module/babel.config.d.ts +0 -10
  130. package/lib/typescript/module/babel.config.d.ts.map +0 -1
  131. package/lib/typescript/module/eslint.config.d.mts +0 -3
  132. package/lib/typescript/module/eslint.config.d.mts.map +0 -1
  133. package/lib/typescript/module/package.json +0 -1
  134. package/lib/typescript/module/scripts/bootstrap.d.ts +0 -2
  135. package/lib/typescript/module/scripts/bootstrap.d.ts.map +0 -1
  136. package/lib/typescript/module/src/context/HyperProvider.gen.d.ts +0 -17
  137. package/lib/typescript/module/src/context/HyperProvider.gen.d.ts.map +0 -1
  138. package/lib/typescript/module/src/context/HyperProvider.res.d.ts +0 -20
  139. package/lib/typescript/module/src/context/HyperProvider.res.d.ts.map +0 -1
  140. package/lib/typescript/module/src/hooks/useHyper.gen.d.ts +0 -10
  141. package/lib/typescript/module/src/hooks/useHyper.gen.d.ts.map +0 -1
  142. package/lib/typescript/module/src/hooks/useHyper.res.d.ts +0 -95
  143. package/lib/typescript/module/src/hooks/useHyper.res.d.ts.map +0 -1
  144. package/lib/typescript/module/src/index.d.ts +0 -4
  145. package/lib/typescript/module/src/index.d.ts.map +0 -1
  146. package/lib/typescript/module/src/modules/NativeHyperswitchSdk.gen.d.ts +0 -24
  147. package/lib/typescript/module/src/modules/NativeHyperswitchSdk.gen.d.ts.map +0 -1
  148. package/lib/typescript/module/src/modules/NativeHyperswitchSdk.res.d.ts +0 -2
  149. package/lib/typescript/module/src/modules/NativeHyperswitchSdk.res.d.ts.map +0 -1
  150. package/lib/typescript/module/src/shims/Js.shim.d.ts +0 -4
  151. package/lib/typescript/module/src/shims/Js.shim.d.ts.map +0 -1
  152. package/lib/typescript/module/src/specs/ApplePayButtonNativeComponent.d.ts +0 -10
  153. package/lib/typescript/module/src/specs/ApplePayButtonNativeComponent.d.ts.map +0 -1
  154. package/lib/typescript/module/src/specs/GooglePayButtonNativeComponent.android.d.ts +0 -11
  155. package/lib/typescript/module/src/specs/GooglePayButtonNativeComponent.android.d.ts.map +0 -1
  156. package/lib/typescript/module/src/specs/HyperswitchSdkReactNativeViewNativeComponent.d.ts +0 -1
  157. package/lib/typescript/module/src/specs/HyperswitchSdkReactNativeViewNativeComponent.d.ts.map +0 -1
  158. package/lib/typescript/module/src/specs/NativeHyperswitchSdkNative.d.ts +0 -17
  159. package/lib/typescript/module/src/specs/NativeHyperswitchSdkNative.d.ts.map +0 -1
  160. package/lib/typescript/module/src/specs/NativeHyperswitchSdkReactNative.d.ts +0 -9
  161. package/lib/typescript/module/src/specs/NativeHyperswitchSdkReactNative.d.ts.map +0 -1
  162. package/lib/typescript/module/src/types/PaymentSheetConfiguration.gen.d.ts +0 -149
  163. package/lib/typescript/module/src/types/PaymentSheetConfiguration.gen.d.ts.map +0 -1
  164. package/lib/typescript/module/src/types/PaymentSheetConfiguration.res.d.ts +0 -1
  165. package/lib/typescript/module/src/types/PaymentSheetConfiguration.res.d.ts.map +0 -1
  166. /package/lib/typescript/{commonjs/babel.config.d.ts → babel.config.d.ts} +0 -0
  167. /package/lib/typescript/{commonjs/eslint.config.d.mts → eslint.config.d.mts} +0 -0
  168. /package/lib/typescript/{commonjs/scripts → scripts}/bootstrap.d.ts +0 -0
  169. /package/lib/typescript/{commonjs/src → src}/context/HyperProvider.gen.d.ts +0 -0
  170. /package/lib/typescript/{commonjs/src → src}/context/HyperProvider.res.d.ts +0 -0
  171. /package/lib/typescript/{commonjs/src → src}/hooks/useHyper.gen.d.ts +0 -0
  172. /package/lib/typescript/{commonjs/src → src}/hooks/useHyper.res.d.ts +0 -0
  173. /package/lib/typescript/{commonjs/src → src}/index.d.ts +0 -0
  174. /package/lib/typescript/{commonjs/src → src}/modules/NativeHyperswitchSdk.gen.d.ts +0 -0
  175. /package/lib/typescript/{commonjs/src → src}/modules/NativeHyperswitchSdk.res.d.ts +0 -0
  176. /package/lib/typescript/{commonjs/src → src}/shims/Js.shim.d.ts +0 -0
  177. /package/lib/typescript/{commonjs/src → src}/specs/ApplePayButtonNativeComponent.d.ts +0 -0
  178. /package/lib/typescript/{commonjs/src → src}/specs/GooglePayButtonNativeComponent.android.d.ts +0 -0
  179. /package/lib/typescript/{commonjs/src → src}/specs/HyperswitchSdkReactNativeViewNativeComponent.d.ts +0 -0
  180. /package/lib/typescript/{commonjs/src → src}/specs/NativeHyperswitchSdkNative.d.ts +0 -0
  181. /package/lib/typescript/{commonjs/src → src}/specs/NativeHyperswitchSdkReactNative.d.ts +0 -0
  182. /package/lib/typescript/{commonjs/src → src}/types/PaymentSheetConfiguration.gen.d.ts +0 -0
  183. /package/lib/typescript/{commonjs/src → src}/types/PaymentSheetConfiguration.res.d.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeHyperswitchSdk.res.d.ts","sourceRoot":"","sources":["../../../../src/modules/NativeHyperswitchSdk.res.js"],"names":[],"mappings":"AAIA,yFAA2D"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Js.shim.d.ts","sourceRoot":"","sources":["../../../../src/shims/Js.shim.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAE5B,MAAM,MAAM,CAAC,GAAG,OAAO,CAAC;AAExB,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApplePayButtonNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/specs/ApplePayButtonNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAExE,UAAU,WAAY,SAAQ,SAAS;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;;AAED,wBAAmE"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GooglePayButtonNativeComponent.android.d.ts","sourceRoot":"","sources":["../../../../src/specs/GooglePayButtonNativeComponent.android.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAExE,UAAU,WAAY,SAAQ,SAAS;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;;AAED,wBAAsE"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HyperswitchSdkReactNativeViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/specs/HyperswitchSdkReactNativeViewNativeComponent.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeHyperswitchSdkNative.d.ts","sourceRoot":"","sources":["../../../../src/specs/NativeHyperswitchSdkNative.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IAEvC,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAG3C,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC;IAE7E,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC;IAGzE,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IACxE,2BAA2B,CACzB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,OAAO,GACb,IAAI,CAAC;IACR,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACrD,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAG9E,wBAAwB,CACtB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GACjC,IAAI,CAAC;IACR,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACxC;wBAEwE,IAAI;AAA7E,wBAA8E"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeHyperswitchSdkReactNative.d.ts","sourceRoot":"","sources":["../../../../src/specs/NativeHyperswitchSdkReactNative.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,UAAU,CACR,cAAc,EAAE,MAAM,EACtB,gBAAgB,EAAE,SAAS,GAAG,MAAM,EACpC,YAAY,EAAE,SAAS,GAAG,MAAM,EAChC,YAAY,EAAE,SAAS,GAAG,MAAM,GAC/B,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,kBAAkB,CAAC,yBAAyB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACvE,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7D;;AAED,wBAEE"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PaymentSheetConfiguration.gen.d.ts","sourceRoot":"","sources":["../../../../src/types/PaymentSheetConfiguration.gen.tsx"],"names":[],"mappings":"AAKA,MAAM,MAAM,WAAW,GACnB,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,OAAO,GACP,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,OAAO,GACP,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,OAAO,GACP,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,OAAO,CAAC;AAEZ,MAAM,MAAM,eAAe,GACvB,YAAY,GACZ,gBAA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AQ,CAAC,8BAA8B,CAAC,EAAE,OAAO,CAAC;IAClD,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IACxC,QAAQ,CAAC,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IAC1C,QAAQ,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAC1C,QAAQ,CAAC,4BAA4B,CAAC,EAAE,MAAM,CAAA;CAC/C,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PaymentSheetConfiguration.res.d.ts","sourceRoot":"","sources":["../../../../src/types/PaymentSheetConfiguration.res.js"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,24 +1,24 @@
1
1
  {
2
2
  "name": "@juspay-tech/react-native-hyperswitch",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Hyperswitch SDK for React Native",
5
- "main": "lib/commonjs/index",
6
- "module": "lib/module/index",
7
- "types": "lib/typescript/commonjs/src/index.d.ts",
5
+ "main": "lib/commonjs/index.bundle.js",
6
+ "module": "lib/module/index.bundle.js",
7
+ "types": "lib/typescript/src/index.d.ts",
8
8
  "react-native": "src/index.tsx",
9
9
  "source": "src/index.tsx",
10
10
  "exports": {
11
11
  ".": {
12
12
  "source": "./src/index.tsx",
13
13
  "import": {
14
- "types": "./lib/typescript/module/src/index.d.ts",
15
- "default": "./lib/module/index.js"
14
+ "types": "./lib/typescript/src/index.d.ts",
15
+ "default": "./lib/module/index.bundle.js"
16
16
  },
17
17
  "require": {
18
- "types": "./lib/typescript/commonjs/src/index.d.ts",
19
- "default": "./lib/commonjs/index.js"
18
+ "types": "./lib/typescript/src/index.d.ts",
19
+ "default": "./lib/commonjs/index.bundle.js"
20
20
  },
21
- "default": "./lib/module/index.js"
21
+ "default": "./lib/module/index.bundle.js"
22
22
  },
23
23
  "./package.json": "./package.json"
24
24
  },
@@ -39,7 +39,11 @@
39
39
  "!**/__tests__",
40
40
  "!**/__fixtures__",
41
41
  "!**/__mocks__",
42
- "!**/.*"
42
+ "!**/.*",
43
+ "tsconfig.build.json",
44
+ "rescript.json",
45
+ "scripts/copy-rescript-deps.js",
46
+ "scripts/rewrite-imports.js"
43
47
  ],
44
48
  "scripts": {
45
49
  "re:start": "rescript build -w",
@@ -51,9 +55,8 @@
51
55
  "typecheck": "tsc",
52
56
  "lint": "eslint \"**/*.{tsx,res}\"",
53
57
  "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
54
- "prepare": "npm run re:build && bob build",
55
- "release": "release-it --only-version",
56
- "postinstall": "npm run re:build"
58
+ "prepare": "npm run re:build && bob build && rollup -c",
59
+ "release": "release-it --only-version"
57
60
  },
58
61
  "keywords": [
59
62
  "react-native",
@@ -78,6 +81,7 @@
78
81
  "../example"
79
82
  ],
80
83
  "devDependencies": {
84
+ "@babel/runtime": "^7.25.0",
81
85
  "@commitlint/config-conventional": "^19.6.0",
82
86
  "@eslint/compat": "^1.2.7",
83
87
  "@eslint/eslintrc": "^3.3.0",
@@ -87,6 +91,11 @@
87
91
  "@react-native/babel-preset": "0.79.2",
88
92
  "@react-native/eslint-config": "^0.78.0",
89
93
  "@release-it/conventional-changelog": "^10.0.1",
94
+ "@rescript/core": "^1.6.1",
95
+ "@rescript/react": "^0.14.0",
96
+ "@rollup/plugin-commonjs": "^29.0.0",
97
+ "@rollup/plugin-node-resolve": "^16.0.3",
98
+ "@rollup/plugin-typescript": "^12.3.0",
90
99
  "@types/jest": "^30.0.0",
91
100
  "@types/react": "^19.1.11",
92
101
  "@types/react-dom": "^19.1.8",
@@ -101,7 +110,10 @@
101
110
  "react-native": "0.79.2",
102
111
  "react-native-builder-bob": "^0.40.8",
103
112
  "release-it": "^19.0.5",
113
+ "rescript": "11",
104
114
  "rescript-react-native": "^0.78.0",
115
+ "rollup": "^4.52.5",
116
+ "rollup-plugin-terser": "^7.0.2",
105
117
  "turbo": "^1.10.7",
106
118
  "typescript": "^5.9.2"
107
119
  },
@@ -110,13 +122,8 @@
110
122
  "react": "*",
111
123
  "react-native": "*",
112
124
  "react-native-inappbrowser-reborn": "*",
113
- "react-native-svg": "*"
114
- },
115
- "dependencies": {
116
- "@babel/runtime": "^7.25.0",
117
- "@rescript/core": "^1.6.1",
118
- "@rescript/react": "^0.14.0",
119
- "rescript": "11"
125
+ "react-native-svg": "*",
126
+ "react-native-webview": "*"
120
127
  },
121
128
  "jest": {
122
129
  "preset": "react-native",
@@ -160,13 +167,6 @@
160
167
  "source": "src",
161
168
  "output": "lib",
162
169
  "targets": [
163
- "commonjs",
164
- [
165
- "module",
166
- {
167
- "esm": true
168
- }
169
- ],
170
170
  [
171
171
  "typescript",
172
172
  {
package/rescript.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@juspay-tech/react-native-hyperswitch",
3
+ "namespace": true,
4
+ "jsx": {"version": 4},
5
+ "package-specs": {
6
+ "module": "esmodule",
7
+ "in-source": true
8
+ },
9
+ "bsc-flags": ["-open RescriptCore"],
10
+ "suffix": ".res.js",
11
+ "sources": [
12
+ {
13
+ "dir": "src",
14
+ "subdirs": true
15
+ }
16
+ ],
17
+ "bs-dependencies": [
18
+ "@rescript/react",
19
+ "rescript-react-native",
20
+ "@rescript/core"
21
+ ],
22
+ "uncurried": true,
23
+ "gentypeconfig": {
24
+ "module": "esmodule",
25
+ "moduleResolution": "node",
26
+ "importPath": "relative",
27
+ "shims": {
28
+ "Js": "Js"
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "extends": "./tsconfig",
3
+ "compilerOptions": {
4
+ "skipLibCheck": true,
5
+ "noUnusedLocals": false,
6
+ "noUnusedParameters": false,
7
+ "moduleResolution": "node"
8
+ },
9
+ "exclude": [
10
+ "example",
11
+ "lib",
12
+ "react-native-debug",
13
+ "**/*.flow.js",
14
+ "**/flow/**/*",
15
+ "**/__tests__/**/*",
16
+ "**/detox-tests/**/*",
17
+ "**/node_modules/**/*",
18
+ "hyperswitch-client-core/**/*"
19
+ ]
20
+ }
@@ -1,39 +0,0 @@
1
- package com.hyperswitchsdkreactnative.activity
2
-
3
- import android.content.Intent
4
- import androidx.appcompat.app.AppCompatActivity
5
- import com.proyecto26.inappbrowser.ChromeTabsDismissedEvent
6
- import com.proyecto26.inappbrowser.ChromeTabsManagerActivity
7
- import org.greenrobot.eventbus.EventBus
8
-
9
- class RedirectActivity : AppCompatActivity() {
10
-
11
- // Override onResume method to handle redirection logic
12
- override fun onResume() {
13
- super.onResume()
14
-
15
- // Get app link data from intent
16
- val appLinkData = intent.data
17
-
18
- // Post ChromeTabsDismissedEvent to EventBus
19
- EventBus.getDefault().post(
20
- ChromeTabsDismissedEvent(
21
- appLinkData?.toString() ?: "chrome tabs activity closed", // Set URL or default message
22
- "cancel", // Set action as cancel
23
- false // Set as not from a user gesture
24
- )
25
- )
26
-
27
- // Start ChromeTabsManagerActivity to dismiss the Chrome tab
28
- startActivity(ChromeTabsManagerActivity.createDismissIntent(applicationContext))
29
-
30
- // Finish the current activity
31
- finish()
32
- }
33
-
34
- // Override onNewIntent to update the intent when a new intent is received
35
- override fun onNewIntent(intent: Intent) {
36
- super.onNewIntent(intent)
37
- setIntent(intent) // Set the new intent
38
- }
39
- }
@@ -1,29 +0,0 @@
1
- package io.hyperswitch.logs
2
-
3
- import android.content.Context
4
- import org.json.JSONException
5
- import org.json.JSONObject
6
-
7
- class CrashHandler(private val context: Context) : Thread.UncaughtExceptionHandler {
8
-
9
- private val defaultHandler = Thread.getDefaultUncaughtExceptionHandler()
10
- private val fileManager = LogFileManager(context)
11
- override fun uncaughtException(thread: Thread, throwable: Throwable) {
12
- val obj =
13
- mapOf(
14
- "label" to "crash_detected",
15
- "value" to throwable.toString(),
16
- "category" to "crash",
17
- "subcategory" to "sdk_crash"
18
- )
19
- try {
20
- val jsonData = JSONObject(obj).toString()
21
- val log = HSLog.LogBuilder().logType("error").category(LogCategory.USER_EVENT)
22
- .eventName(EventName.CRASH_EVENT).value(jsonData).version("0.0.1")
23
- HyperLogManager.addLog(log.build())
24
- } catch (_: JSONException) {
25
- }
26
- fileManager.addLog(HyperLogManager.getAllLogsAsString())
27
- defaultHandler?.uncaughtException(thread, throwable)
28
- }
29
- }
@@ -1,20 +0,0 @@
1
- package io.hyperswitch.logs
2
-
3
- import android.os.Handler
4
- import android.os.Looper
5
-
6
- class Debouncer(private val delayInMillis: Long) {
7
- private val handler = Handler(Looper.getMainLooper())
8
- private var runnable: Runnable? = null
9
-
10
- fun debounce(action: () -> Unit) {
11
- cancel()
12
- runnable = Runnable { action() }
13
- handler.postDelayed(runnable!!, delayInMillis)
14
- }
15
-
16
- fun cancel() {
17
- runnable?.let { handler.removeCallbacks(it) }
18
- runnable = null
19
- }
20
- }
@@ -1,113 +0,0 @@
1
- package io.hyperswitch.logs
2
-
3
- import io.hyperswitch.networking.HyperNetworking
4
- import io.hyperswitch.react.Utils.Companion.getLoggingUrl
5
- import org.json.JSONArray
6
-
7
- object HyperLogManager {
8
-
9
- private val logsBatch = mutableListOf<HSLog>()
10
- private var publishableKey: String? = null
11
- private var loggingEndPoint: String? = null
12
- private const val DEFAULT_DELAY_IN_MILLIS = 2000L
13
- private var delayInMillis: Long = DEFAULT_DELAY_IN_MILLIS
14
- private var hyperOtaVersion: String = ""
15
- private val debouncer = Debouncer(DEFAULT_DELAY_IN_MILLIS)
16
-
17
- fun initialise(
18
- pkKey: String,
19
- customLogUrl: String?,
20
- delay: Long = DEFAULT_DELAY_IN_MILLIS
21
- ) {
22
- if (pkKey.isNotBlank()) {
23
- publishableKey = pkKey
24
- delayInMillis = delay
25
- if (customLogUrl != "" && customLogUrl != null) {
26
- loggingEndPoint = customLogUrl
27
- } else {
28
- loggingEndPoint = getLoggingUrl(pkKey)
29
- }
30
- }
31
- }
32
-
33
- fun addLog(log: HSLog) {
34
- logsBatch.add(log)
35
- debouncedPushLogs()
36
- }
37
-
38
- fun sendLogsFromFile(fileManager: LogFileManager) {
39
- if (publishableKey.isNullOrBlank()) return
40
- try {
41
- val logArray = fileManager.getAllLogs()
42
- if (logArray.length() > 0) {
43
- enrichLogs(logArray)
44
- loggingEndPoint?.let { endpoint ->
45
- try {
46
- HyperNetworking.makePostRequest(
47
- endpoint,
48
- logArray.toString(),
49
- callback = { result ->
50
- result.onSuccess {
51
- fileManager.clearFile()
52
- }
53
- })
54
- } catch (_: Exception) {
55
- }
56
- }
57
- }
58
- } catch (e: Exception) {
59
- e.printStackTrace()
60
- }
61
- }
62
-
63
- fun setOtaVersion(version: String) {
64
- hyperOtaVersion = version
65
- debouncedPushLogs()
66
- }
67
-
68
- private fun debouncedPushLogs() {
69
- debouncer.debounce { sendLogsOverNetwork() }
70
- }
71
-
72
- private fun enrichLogs(logsArray: JSONArray) {
73
- for (i in 0 until logsArray.length()) {
74
- logsArray.getJSONObject(i).apply {
75
- put("merchant_id", publishableKey)
76
- put("code_push_version", hyperOtaVersion)
77
- put("client_core_version", hyperOtaVersion)
78
- }
79
- }
80
- }
81
-
82
- fun getAllLogsAsString(): String =
83
- logsBatch.joinToString(prefix = "[", postfix = "]") { it.toJson() }
84
-
85
- private fun sendLogsOverNetwork() {
86
- if (logsBatch.isEmpty()) {
87
- return
88
- }
89
- if (!publishableKey.isNullOrBlank() && !loggingEndPoint.isNullOrBlank()) {
90
- logsBatch.map { log ->
91
- log.apply {
92
- merchantId = publishableKey!!
93
- codePushVersion = hyperOtaVersion
94
- clientCoreVersion = hyperOtaVersion
95
- }
96
- }
97
- val logsToSend = getAllLogsAsString()
98
- logsBatch.clear()
99
- loggingEndPoint?.let { endpoint ->
100
- try {
101
- HyperNetworking.makePostRequest(
102
- endpoint, logsToSend,
103
- callback = {}
104
- )
105
- } catch (_: Exception) {
106
- }
107
- }
108
- } else {
109
- debouncedPushLogs()
110
- }
111
- }
112
-
113
- }
@@ -1,159 +0,0 @@
1
- package io.hyperswitch.logs
2
-
3
- import org.json.JSONException
4
- import org.json.JSONObject
5
-
6
- enum class LogType {
7
- DEBUG, INFO, ERROR, WARNING
8
- }
9
-
10
- enum class LogCategory {
11
- API, USER_ERROR, USER_EVENT, MERCHANT_EVENT, OTA_LIFE_CYCLE
12
- }
13
-
14
- enum class EventName {
15
- HYPER_OTA_INIT, HYPER_OTA_FINISH, HYPER_OTA_EVENT, CRASH_EVENT
16
- }
17
-
18
- data class HSLog(
19
- val timestamp: String,
20
- val logType: LogType,
21
- val component: String = "MOBILE",
22
- val category: LogCategory,
23
- val version: String,
24
- var codePushVersion: String,
25
- var clientCoreVersion: String,
26
- val value: String,
27
- val internalMetadata: String,
28
- val sessionId: String,
29
- var merchantId: String,
30
- val paymentId: String,
31
- val appId: String? = null,
32
- val platform: String = "ANDROID",
33
- val userAgent: String,
34
- val eventName: EventName,
35
- val latency: String? = null,
36
- val firstEvent: Boolean = false,
37
- val paymentMethod: String? = null,
38
- val paymentExperience: String? = null,
39
- val source: String
40
- ) {
41
- fun toJson(): String {
42
- try {
43
-
44
- val logData = JSONObject().apply {
45
- put("timestamp", timestamp)
46
- put("log_type", logType.name)
47
- put("component", component)
48
- put("category", category.toString())
49
- put("version", version)
50
- put("code_push_version", codePushVersion)
51
- put("client_core_version", clientCoreVersion)
52
- put("value", value)
53
- put("internal_metadata", internalMetadata)
54
- put("session_id", sessionId)
55
- put("merchant_id", merchantId)
56
- put("payment_id", paymentId)
57
- put("app_id", appId ?: "")
58
- put("platform", platform)
59
- put("user_agent", userAgent)
60
- put("event_name", eventName.name)
61
- put("first_event", firstEvent.toString())
62
- put("payment_method", paymentMethod ?: "")
63
- put("payment_experience", paymentExperience ?: "")
64
- put("latency", latency ?: "")
65
- put("source", source)
66
- }
67
-
68
- val jsonString = logData.toString()
69
- return jsonString
70
- } catch (e: JSONException) {
71
- return ""
72
- }
73
- }
74
-
75
-
76
- class LogBuilder {
77
- private var timestamp: String = System.currentTimeMillis().toString()
78
- private var logType: LogType = LogType.INFO
79
- private var component: String = "MOBILE"
80
- private lateinit var category: LogCategory
81
- private var version: String = ""
82
- private var codePushVersion: String = ""
83
- private var clientCoreVersion: String = ""
84
- private var value: String = ""
85
- private var internalMetadata: String = ""
86
- private var sessionId: String = ""
87
- private var merchantId: String = ""
88
- private var paymentId: String = ""
89
- private var appId: String? = null
90
- private var platform: String = "ANDROID"
91
- private var userAgent: String = ""
92
- private lateinit var eventName: EventName
93
- private var latency: String? = null
94
- private var firstEvent: Boolean = false
95
- private var paymentMethod: String? = null
96
- private var paymentExperience: String? = null
97
- private var source: String = ""
98
-
99
- fun timestamp(timestamp: String) = apply { this.timestamp = timestamp }
100
- fun logType(logType: String) = apply {
101
- this.logType =
102
- LogType.entries.find { it.name == logType.uppercase() } ?: LogType.INFO
103
- }
104
-
105
- fun component(component: String) = apply { this.component = component }
106
- fun category(category: LogCategory) = apply { this.category = category }
107
- fun version(version: String) = apply { this.version = version }
108
- fun codePushVersion(codePushVersion: String) =
109
- apply { this.codePushVersion = codePushVersion }
110
-
111
- fun clientCoreVersion(clientCoreVersion: String) =
112
- apply { this.clientCoreVersion = clientCoreVersion }
113
-
114
- fun value(value: String) = apply { this.value = value }
115
- fun internalMetadata(internalMetadata: String) =
116
- apply { this.internalMetadata = internalMetadata }
117
-
118
- fun sessionId(sessionId: String) = apply { this.sessionId = sessionId }
119
- fun merchantId(merchantId: String) = apply { this.merchantId = merchantId }
120
- fun paymentId(paymentId: String) = apply { this.paymentId = paymentId }
121
- fun appId(appId: String?) = apply { this.appId = appId }
122
- fun platform(platform: String) = apply { this.platform = platform }
123
- fun userAgent(userAgent: String) = apply { this.userAgent = userAgent }
124
- fun eventName(eventName: EventName) = apply { this.eventName = eventName }
125
- fun latency(latency: String?) = apply { this.latency = latency }
126
- fun firstEvent(firstEvent: Boolean) = apply { this.firstEvent = firstEvent }
127
- fun paymentMethod(paymentMethod: String?) = apply { this.paymentMethod = paymentMethod }
128
- fun paymentExperience(paymentExperience: String?) =
129
- apply { this.paymentExperience = paymentExperience }
130
-
131
- fun source(source: String) = apply { this.source = source }
132
-
133
- fun build(): HSLog {
134
- return HSLog(
135
- timestamp,
136
- logType,
137
- component,
138
- category,
139
- version,
140
- codePushVersion,
141
- clientCoreVersion,
142
- value,
143
- internalMetadata,
144
- sessionId,
145
- merchantId,
146
- paymentId,
147
- appId,
148
- platform,
149
- userAgent,
150
- eventName,
151
- latency,
152
- firstEvent,
153
- paymentMethod,
154
- paymentExperience,
155
- source
156
- )
157
- }
158
- }
159
- }
@@ -1,60 +0,0 @@
1
- package io.hyperswitch.logs
2
-
3
- import android.content.Context
4
- import org.json.JSONArray
5
- import org.json.JSONException
6
- import java.io.File
7
- import java.io.IOException
8
-
9
- class LogFileManager(private val context: Context) {
10
-
11
- private val crashLogFileName = "crash_logs.json"
12
- fun addLog(log: String) {
13
- try {
14
- val existingLogs = getAllLogs()
15
- val newLogsArray = JSONArray(log)
16
- for (i in 0 until newLogsArray.length()) {
17
- existingLogs.put(newLogsArray.get(i))
18
- }
19
- writeLogsToFile(existingLogs)
20
- } catch (e: JSONException) {
21
- e.printStackTrace()
22
- }
23
- }
24
-
25
- fun getAllLogs(): JSONArray {
26
- return try {
27
- val file = File(context.filesDir, crashLogFileName)
28
- if (file.exists()) {
29
- val content = file.readText()
30
- JSONArray(content)
31
- } else {
32
- JSONArray()
33
- }
34
- } catch (e: JSONException) {
35
- JSONArray()
36
- } catch (e: IOException) {
37
- JSONArray()
38
- }
39
- }
40
-
41
- private fun writeLogsToFile(logs: JSONArray) {
42
- try {
43
- val file = File(context.filesDir, crashLogFileName)
44
- file.writeText(logs.toString()) // Write the logs as a JSON string
45
- } catch (e: IOException) {
46
- e.printStackTrace()
47
- }
48
- }
49
-
50
- fun clearFile() {
51
- try {
52
- val file = File(context.filesDir, "crash_logs.json")
53
- if (file.exists()) {
54
- file.delete()
55
- }
56
- } catch (e: IOException) {
57
- e.printStackTrace()
58
- }
59
- }
60
- }