@juspay-tech/react-native-hyperswitch 0.2.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.
- package/HyperswitchSdkReactNative.podspec +31 -0
- package/android/build.gradle +119 -0
- package/android/gradle.properties +5 -0
- package/android/hyperswitch_autolinking.gradle +378 -0
- package/android/proguard-rules.pro +72 -0
- package/android/src/main/AndroidManifest.xml +25 -0
- package/android/src/main/assets/hyperswitch.bundle +1677 -0
- package/android/src/main/java/com/hyperswitchsdkreactnative/HyperswitchSdkReactNativePackage.kt +36 -0
- package/android/src/main/java/com/hyperswitchsdkreactnative/activity/RedirectActivity.kt +39 -0
- package/android/src/main/java/com/hyperswitchsdkreactnative/internal/DefaultReactHost.kt +314 -0
- package/android/src/main/java/com/hyperswitchsdkreactnative/internal/DefaultReactNativeHost.kt +131 -0
- package/android/src/main/java/com/hyperswitchsdkreactnative/internal/ReactDelegate.kt +423 -0
- package/android/src/main/java/com/hyperswitchsdkreactnative/internal/ReactFragment.kt +335 -0
- package/android/src/main/java/com/hyperswitchsdkreactnative/modules/HyperswitchSdkNativeModule.kt +143 -0
- package/android/src/main/java/com/hyperswitchsdkreactnative/modules/HyperswitchSdkReactNativeModule.kt +92 -0
- package/android/src/main/java/com/hyperswitchsdkreactnative/provider/HyperProvider.kt +269 -0
- package/android/src/main/java/com/hyperswitchsdkreactnative/views/GooglePayButtonView.kt +60 -0
- package/android/src/main/java/com/hyperswitchsdkreactnative/views/GooglePayButtonViewManager.kt +76 -0
- package/android/src/main/java/io/hyperswitch/hyperota/HyperOtaLogger.kt +122 -0
- package/android/src/main/java/io/hyperswitch/logs/CrashHandler.kt +29 -0
- package/android/src/main/java/io/hyperswitch/logs/Debouncer.kt +20 -0
- package/android/src/main/java/io/hyperswitch/logs/HyperLogManager.kt +113 -0
- package/android/src/main/java/io/hyperswitch/logs/LogData.kt +159 -0
- package/android/src/main/java/io/hyperswitch/logs/LogFileManager.kt +60 -0
- package/android/src/main/java/io/hyperswitch/networking/HyperNetworking.kt +73 -0
- package/android/src/main/java/io/hyperswitch/react/Utils.kt +23 -0
- package/android/src/main/res/values/attrs.xml +6 -0
- package/android/src/main/res/values/strings.xml +5 -0
- package/android/src/main/res/values/theme.xml +16 -0
- package/ios/Modules/HyperswitchModule.swift +61 -0
- package/ios/Modules/HyperswitchNativeModule.swift +113 -0
- package/ios/Modules/HyperswitchSdkNative.h +5 -0
- package/ios/Modules/HyperswitchSdkNative.mm +98 -0
- package/ios/Modules/HyperswitchSdkReactNative.h +5 -0
- package/ios/Modules/HyperswitchSdkReactNative.mm +53 -0
- package/ios/Views/ApplePayView.h +14 -0
- package/ios/Views/ApplePayView.mm +89 -0
- package/ios/hyperswitchSDK/Core/ApplePay/ApplePayHandler.swift +249 -0
- package/ios/hyperswitchSDK/Core/ApplePay/ApplePayViewManager.m +18 -0
- package/ios/hyperswitchSDK/Core/ApplePay/ApplePayViewManager.swift +123 -0
- package/ios/hyperswitchSDK/Core/HyperPaymentSheet/PaymentSheetView+SwiftUI.swift +49 -0
- package/ios/hyperswitchSDK/Core/HyperPaymentSheet/PaymentSheetView+UIKit.swift +49 -0
- package/ios/hyperswitchSDK/Core/HyperPaymentSheet/PaymentSheetView.swift +80 -0
- package/ios/hyperswitchSDK/Core/HyperSession/PaymentSession+UIKit.swift +176 -0
- package/ios/hyperswitchSDK/Core/HyperSession/PaymentSessionTypes.swift +121 -0
- package/ios/hyperswitchSDK/Core/Models/LogPayload.swift +53 -0
- package/ios/hyperswitchSDK/Core/NativeLogger/Debouncer.swift +37 -0
- package/ios/hyperswitchSDK/Core/NativeLogger/LogBuilder.swift +91 -0
- package/ios/hyperswitchSDK/Core/NativeLogger/LogFileManager.swift +75 -0
- package/ios/hyperswitchSDK/Core/NativeLogger/LogManager.swift +113 -0
- package/ios/hyperswitchSDK/Core/NativeModule/HyperHeadless.m +16 -0
- package/ios/hyperswitchSDK/Core/NativeModule/HyperHeadless.swift +74 -0
- package/ios/hyperswitchSDK/Core/NativeModule/HyperModule.m +28 -0
- package/ios/hyperswitchSDK/Core/NativeModule/HyperModule.swift +168 -0
- package/ios/hyperswitchSDK/Core/NativeModule/OTAServices.swift +113 -0
- package/ios/hyperswitchSDK/Core/NativeModule/RNHeadlessManager.swift +45 -0
- package/ios/hyperswitchSDK/Core/NativeModule/RNResponseHandler.swift +12 -0
- package/ios/hyperswitchSDK/Core/NativeModule/RNViewManager.swift +90 -0
- package/ios/hyperswitchSDK/Core/NativeModule/hyper-Bridging-Header.h +9 -0
- package/ios/hyperswitchSDK/Core/Resources/HyperOTA.plist +20 -0
- package/ios/hyperswitchSDK/Core/Resources/hyperswitch.bundle +1673 -0
- package/ios/hyperswitchSDK/Shared/APIClient.swift +21 -0
- package/ios/hyperswitchSDK/Shared/DictionaryConverter.swift +104 -0
- package/ios/hyperswitchSDK/Shared/Environment.swift +24 -0
- package/ios/hyperswitchSDK/Shared/Extensions.swift +31 -0
- package/ios/hyperswitchSDK/Shared/Helper.swift +16 -0
- package/ios/hyperswitchSDK/Shared/HyperNetworking.swift +137 -0
- package/ios/hyperswitchSDK/Shared/HyperParams.swift +44 -0
- package/ios/hyperswitchSDK/Shared/HyperUIViewController.swift +25 -0
- package/ios/hyperswitchSDK/Shared/PaymentSession.swift +43 -0
- package/ios/hyperswitchSDK/Shared/PaymentSheet.swift +30 -0
- package/ios/hyperswitchSDK/Shared/PaymentSheetAppearance.swift +264 -0
- package/ios/hyperswitchSDK/Shared/PaymentSheetConfiguration.swift +494 -0
- package/ios/hyperswitchSDK/Shared/SwiftUIManager.swift +28 -0
- package/ios/hyperswitchSDK/Shared/Version.swift +12 -0
- package/lib/bs/JuspayTechReactNativeHyperswitch.cmi +0 -0
- package/lib/bs/JuspayTechReactNativeHyperswitch.cmj +0 -0
- package/lib/bs/JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/JuspayTechReactNativeHyperswitch.mlmap +5 -0
- package/lib/bs/build.ninja +29 -0
- package/lib/bs/install.ninja +25 -0
- package/lib/bs/src/context/HyperProvider-JuspayTechReactNativeHyperswitch.cmi +0 -0
- package/lib/bs/src/context/HyperProvider-JuspayTechReactNativeHyperswitch.cmj +0 -0
- package/lib/bs/src/context/HyperProvider-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/context/HyperProvider.ast +0 -0
- package/lib/bs/src/context/HyperProvider.d +1 -0
- package/lib/bs/src/hooks/useHyper-JuspayTechReactNativeHyperswitch.cmi +0 -0
- package/lib/bs/src/hooks/useHyper-JuspayTechReactNativeHyperswitch.cmj +0 -0
- package/lib/bs/src/hooks/useHyper-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/hooks/useHyper.ast +0 -0
- package/lib/bs/src/hooks/useHyper.d +1 -0
- package/lib/bs/src/modules/NativeHyperswitchSdk-JuspayTechReactNativeHyperswitch.cmi +0 -0
- package/lib/bs/src/modules/NativeHyperswitchSdk-JuspayTechReactNativeHyperswitch.cmj +0 -0
- package/lib/bs/src/modules/NativeHyperswitchSdk-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/modules/NativeHyperswitchSdk.ast +0 -0
- package/lib/bs/src/modules/NativeHyperswitchSdk.d +1 -0
- package/lib/bs/src/types/PaymentSheetConfiguration-JuspayTechReactNativeHyperswitch.cmi +0 -0
- package/lib/bs/src/types/PaymentSheetConfiguration-JuspayTechReactNativeHyperswitch.cmj +0 -0
- package/lib/bs/src/types/PaymentSheetConfiguration-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/types/PaymentSheetConfiguration.ast +0 -0
- package/lib/bs/src/types/PaymentSheetConfiguration.d +1 -0
- package/lib/commonjs/context/HyperProvider.gen.js +16 -0
- package/lib/commonjs/context/HyperProvider.gen.js.map +1 -0
- package/lib/commonjs/context/HyperProvider.res +78 -0
- package/lib/commonjs/context/HyperProvider.res.js +98 -0
- package/lib/commonjs/context/HyperProvider.res.js.map +1 -0
- package/lib/commonjs/hooks/useHyper.gen.js +15 -0
- package/lib/commonjs/hooks/useHyper.gen.js.map +1 -0
- package/lib/commonjs/hooks/useHyper.res +142 -0
- package/lib/commonjs/hooks/useHyper.res.js +152 -0
- package/lib/commonjs/hooks/useHyper.res.js.map +1 -0
- package/lib/commonjs/index.js +26 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/modules/NativeHyperswitchSdk.gen.js +6 -0
- package/lib/commonjs/modules/NativeHyperswitchSdk.gen.js.map +1 -0
- package/lib/commonjs/modules/NativeHyperswitchSdk.res +55 -0
- package/lib/commonjs/modules/NativeHyperswitchSdk.res.js +14 -0
- package/lib/commonjs/modules/NativeHyperswitchSdk.res.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/shims/Js.shim.js +2 -0
- package/lib/commonjs/shims/Js.shim.js.map +1 -0
- package/lib/commonjs/specs/ApplePayButtonNativeComponent.ts +11 -0
- package/lib/commonjs/specs/GooglePayButtonNativeComponent.android.js +10 -0
- package/lib/commonjs/specs/GooglePayButtonNativeComponent.android.js.map +1 -0
- package/lib/commonjs/specs/HyperswitchSdkReactNativeViewNativeComponent.ts +10 -0
- package/lib/commonjs/specs/NativeHyperswitchSdkNative.js +9 -0
- package/lib/commonjs/specs/NativeHyperswitchSdkNative.js.map +1 -0
- package/lib/commonjs/specs/NativeHyperswitchSdkReactNative.js +9 -0
- package/lib/commonjs/specs/NativeHyperswitchSdkReactNative.js.map +1 -0
- package/lib/commonjs/types/PaymentSheetConfiguration.gen.js +2 -0
- package/lib/commonjs/types/PaymentSheetConfiguration.gen.js.map +1 -0
- package/lib/commonjs/types/PaymentSheetConfiguration.res +215 -0
- package/lib/commonjs/types/PaymentSheetConfiguration.res.js +4 -0
- package/lib/commonjs/types/PaymentSheetConfiguration.res.js.map +1 -0
- package/lib/module/context/HyperProvider.gen.js +11 -0
- package/lib/module/context/HyperProvider.gen.js.map +1 -0
- package/lib/module/context/HyperProvider.res +78 -0
- package/lib/module/context/HyperProvider.res.js +91 -0
- package/lib/module/context/HyperProvider.res.js.map +1 -0
- package/lib/module/hooks/useHyper.gen.js +10 -0
- package/lib/module/hooks/useHyper.gen.js.map +1 -0
- package/lib/module/hooks/useHyper.res +142 -0
- package/lib/module/hooks/useHyper.res.js +142 -0
- package/lib/module/hooks/useHyper.res.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/modules/NativeHyperswitchSdk.gen.js +4 -0
- package/lib/module/modules/NativeHyperswitchSdk.gen.js.map +1 -0
- package/lib/module/modules/NativeHyperswitchSdk.res +55 -0
- package/lib/module/modules/NativeHyperswitchSdk.res.js +9 -0
- package/lib/module/modules/NativeHyperswitchSdk.res.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/shims/Js.shim.js +2 -0
- package/lib/module/shims/Js.shim.js.map +1 -0
- package/lib/module/specs/ApplePayButtonNativeComponent.ts +11 -0
- package/lib/module/specs/GooglePayButtonNativeComponent.android.js +5 -0
- package/lib/module/specs/GooglePayButtonNativeComponent.android.js.map +1 -0
- package/lib/module/specs/HyperswitchSdkReactNativeViewNativeComponent.ts +10 -0
- package/lib/module/specs/NativeHyperswitchSdkNative.js +5 -0
- package/lib/module/specs/NativeHyperswitchSdkNative.js.map +1 -0
- package/lib/module/specs/NativeHyperswitchSdkReactNative.js +5 -0
- package/lib/module/specs/NativeHyperswitchSdkReactNative.js.map +1 -0
- package/lib/module/types/PaymentSheetConfiguration.gen.js +2 -0
- package/lib/module/types/PaymentSheetConfiguration.gen.js.map +1 -0
- package/lib/module/types/PaymentSheetConfiguration.res +215 -0
- package/lib/module/types/PaymentSheetConfiguration.res.js +4 -0
- package/lib/module/types/PaymentSheetConfiguration.res.js.map +1 -0
- package/lib/typescript/commonjs/babel.config.d.ts +10 -0
- package/lib/typescript/commonjs/babel.config.d.ts.map +1 -0
- package/lib/typescript/commonjs/eslint.config.d.mts +3 -0
- package/lib/typescript/commonjs/eslint.config.d.mts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/scripts/bootstrap.d.ts +2 -0
- package/lib/typescript/commonjs/scripts/bootstrap.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/context/HyperProvider.gen.d.ts +17 -0
- package/lib/typescript/commonjs/src/context/HyperProvider.gen.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/context/HyperProvider.res.d.ts +20 -0
- package/lib/typescript/commonjs/src/context/HyperProvider.res.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/hooks/useHyper.gen.d.ts +10 -0
- package/lib/typescript/commonjs/src/hooks/useHyper.gen.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/hooks/useHyper.res.d.ts +95 -0
- package/lib/typescript/commonjs/src/hooks/useHyper.res.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +4 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/NativeHyperswitchSdk.gen.d.ts +24 -0
- package/lib/typescript/commonjs/src/modules/NativeHyperswitchSdk.gen.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/NativeHyperswitchSdk.res.d.ts +2 -0
- package/lib/typescript/commonjs/src/modules/NativeHyperswitchSdk.res.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/shims/Js.shim.d.ts +4 -0
- package/lib/typescript/commonjs/src/shims/Js.shim.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/specs/ApplePayButtonNativeComponent.d.ts +10 -0
- package/lib/typescript/commonjs/src/specs/ApplePayButtonNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/specs/GooglePayButtonNativeComponent.android.d.ts +11 -0
- package/lib/typescript/commonjs/src/specs/GooglePayButtonNativeComponent.android.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/specs/HyperswitchSdkReactNativeViewNativeComponent.d.ts +1 -0
- package/lib/typescript/commonjs/src/specs/HyperswitchSdkReactNativeViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/specs/NativeHyperswitchSdkNative.d.ts +17 -0
- package/lib/typescript/commonjs/src/specs/NativeHyperswitchSdkNative.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/specs/NativeHyperswitchSdkReactNative.d.ts +9 -0
- package/lib/typescript/commonjs/src/specs/NativeHyperswitchSdkReactNative.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/PaymentSheetConfiguration.gen.d.ts +149 -0
- package/lib/typescript/commonjs/src/types/PaymentSheetConfiguration.gen.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/PaymentSheetConfiguration.res.d.ts +1 -0
- package/lib/typescript/commonjs/src/types/PaymentSheetConfiguration.res.d.ts.map +1 -0
- package/lib/typescript/module/babel.config.d.ts +10 -0
- package/lib/typescript/module/babel.config.d.ts.map +1 -0
- package/lib/typescript/module/eslint.config.d.mts +3 -0
- package/lib/typescript/module/eslint.config.d.mts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/scripts/bootstrap.d.ts +2 -0
- package/lib/typescript/module/scripts/bootstrap.d.ts.map +1 -0
- package/lib/typescript/module/src/context/HyperProvider.gen.d.ts +17 -0
- package/lib/typescript/module/src/context/HyperProvider.gen.d.ts.map +1 -0
- package/lib/typescript/module/src/context/HyperProvider.res.d.ts +20 -0
- package/lib/typescript/module/src/context/HyperProvider.res.d.ts.map +1 -0
- package/lib/typescript/module/src/hooks/useHyper.gen.d.ts +10 -0
- package/lib/typescript/module/src/hooks/useHyper.gen.d.ts.map +1 -0
- package/lib/typescript/module/src/hooks/useHyper.res.d.ts +95 -0
- package/lib/typescript/module/src/hooks/useHyper.res.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +4 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/NativeHyperswitchSdk.gen.d.ts +24 -0
- package/lib/typescript/module/src/modules/NativeHyperswitchSdk.gen.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/NativeHyperswitchSdk.res.d.ts +2 -0
- package/lib/typescript/module/src/modules/NativeHyperswitchSdk.res.d.ts.map +1 -0
- package/lib/typescript/module/src/shims/Js.shim.d.ts +4 -0
- package/lib/typescript/module/src/shims/Js.shim.d.ts.map +1 -0
- package/lib/typescript/module/src/specs/ApplePayButtonNativeComponent.d.ts +10 -0
- package/lib/typescript/module/src/specs/ApplePayButtonNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/specs/GooglePayButtonNativeComponent.android.d.ts +11 -0
- package/lib/typescript/module/src/specs/GooglePayButtonNativeComponent.android.d.ts.map +1 -0
- package/lib/typescript/module/src/specs/HyperswitchSdkReactNativeViewNativeComponent.d.ts +1 -0
- package/lib/typescript/module/src/specs/HyperswitchSdkReactNativeViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/specs/NativeHyperswitchSdkNative.d.ts +17 -0
- package/lib/typescript/module/src/specs/NativeHyperswitchSdkNative.d.ts.map +1 -0
- package/lib/typescript/module/src/specs/NativeHyperswitchSdkReactNative.d.ts +9 -0
- package/lib/typescript/module/src/specs/NativeHyperswitchSdkReactNative.d.ts.map +1 -0
- package/lib/typescript/module/src/types/PaymentSheetConfiguration.gen.d.ts +149 -0
- package/lib/typescript/module/src/types/PaymentSheetConfiguration.gen.d.ts.map +1 -0
- package/lib/typescript/module/src/types/PaymentSheetConfiguration.res.d.ts +1 -0
- package/lib/typescript/module/src/types/PaymentSheetConfiguration.res.d.ts.map +1 -0
- package/package.json +196 -0
- package/src/context/HyperProvider.gen.tsx +26 -0
- package/src/context/HyperProvider.res +78 -0
- package/src/context/HyperProvider.res.js +112 -0
- package/src/hooks/useHyper.gen.tsx +18 -0
- package/src/hooks/useHyper.res +142 -0
- package/src/hooks/useHyper.res.js +157 -0
- package/src/index.tsx +13 -0
- package/src/modules/NativeHyperswitchSdk.gen.tsx +25 -0
- package/src/modules/NativeHyperswitchSdk.res +55 -0
- package/src/modules/NativeHyperswitchSdk.res.js +10 -0
- package/src/shims/Js.shim.ts +5 -0
- package/src/specs/ApplePayButtonNativeComponent.ts +11 -0
- package/src/specs/GooglePayButtonNativeComponent.android.ts +12 -0
- package/src/specs/HyperswitchSdkReactNativeViewNativeComponent.ts +10 -0
- package/src/specs/NativeHyperswitchSdkNative.ts +33 -0
- package/src/specs/NativeHyperswitchSdkReactNative.ts +17 -0
- package/src/types/PaymentSheetConfiguration.gen.tsx +202 -0
- package/src/types/PaymentSheetConfiguration.res +215 -0
- package/src/types/PaymentSheetConfiguration.res.js +2 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_NativeHyperswitchSdkReactNative","_interopRequireDefault","require","e","__esModule","default","nativeHyperswitchSdk","exports","NativeHyperswitchSdkReactNative"],"sourceRoot":"../../../src","sources":["modules/NativeHyperswitchSdk.res.js"],"mappings":";;;;;;AAEA,IAAAA,gCAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuF,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAFvF;;AAIA,IAAIG,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAGE,wCAA+B;;AAK1D","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["shims/Js.shim.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
2
|
+
import type { ViewProps } from 'react-native';
|
|
3
|
+
import type { Double } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
|
+
|
|
5
|
+
interface NativeProps extends ViewProps {
|
|
6
|
+
buttonType?: string;
|
|
7
|
+
buttonStyle?: string;
|
|
8
|
+
cornerRadius?: Double;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default codegenNativeComponent<NativeProps>('ApplePayView');
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _codegenNativeComponent = _interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeComponent"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = (0, _codegenNativeComponent.default)('GooglePayButton');
|
|
10
|
+
//# sourceMappingURL=GooglePayButtonNativeComponent.android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_codegenNativeComponent","_interopRequireDefault","require","e","__esModule","default","_default","exports","codegenNativeComponent"],"sourceRoot":"../../../src","sources":["specs/GooglePayButtonNativeComponent.android.ts"],"mappings":";;;;;;AAAA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA6F,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAW9E,IAAAG,+BAAsB,EAAc,iBAAiB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
2
|
+
// import type { ViewProps } from 'react-native';
|
|
3
|
+
|
|
4
|
+
// interface NativeProps extends ViewProps {
|
|
5
|
+
// color?: string;
|
|
6
|
+
// }
|
|
7
|
+
|
|
8
|
+
// export default codegenNativeComponent<NativeProps>(
|
|
9
|
+
// 'HyperswitchSdkReactNativeView'
|
|
10
|
+
// );
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _default = exports.default = _reactNative.TurboModuleRegistry.getEnforcing('HyperModules');
|
|
9
|
+
//# sourceMappingURL=NativeHyperswitchSdkNative.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../../src","sources":["specs/NativeHyperswitchSdkNative.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GA+BpCC,gCAAmB,CAACC,YAAY,CAAO,cAAc,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _default = exports.default = _reactNative.TurboModuleRegistry.getEnforcing('HyperswitchSdkReactNative');
|
|
9
|
+
//# sourceMappingURL=NativeHyperswitchSdkReactNative.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../../src","sources":["specs/NativeHyperswitchSdkReactNative.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAapCC,gCAAmB,CAACC,YAAY,CAC7C,2BACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/PaymentSheetConfiguration.gen.tsx"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
type localeTypes =
|
|
2
|
+
| En
|
|
3
|
+
| He
|
|
4
|
+
| Fr
|
|
5
|
+
| En_GB
|
|
6
|
+
| Ar
|
|
7
|
+
| Ja
|
|
8
|
+
| De
|
|
9
|
+
| Fr_BE
|
|
10
|
+
| Es
|
|
11
|
+
| Ca
|
|
12
|
+
| Pt
|
|
13
|
+
| It
|
|
14
|
+
| Pl
|
|
15
|
+
| Nl
|
|
16
|
+
| NI_BE
|
|
17
|
+
| Sv
|
|
18
|
+
| Ru
|
|
19
|
+
| Lt
|
|
20
|
+
| Cs
|
|
21
|
+
| Sk
|
|
22
|
+
| Ls
|
|
23
|
+
| Cy
|
|
24
|
+
| El
|
|
25
|
+
| Et
|
|
26
|
+
| Fi
|
|
27
|
+
| Nb
|
|
28
|
+
| Bs
|
|
29
|
+
| Da
|
|
30
|
+
| Ms
|
|
31
|
+
| Tr_CY
|
|
32
|
+
|
|
33
|
+
type fontFamilyTypes = DefaultIOS | DefaultAndroid | CustomFont(string) | DefaultWeb
|
|
34
|
+
|
|
35
|
+
type placeholder = {
|
|
36
|
+
cardNumber?: string,
|
|
37
|
+
expiryDate?: string,
|
|
38
|
+
cvv?: string,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
type address = {
|
|
42
|
+
first_name?: string,
|
|
43
|
+
last_name?: string,
|
|
44
|
+
city?: string,
|
|
45
|
+
country?: string,
|
|
46
|
+
line1?: string,
|
|
47
|
+
line2?: string,
|
|
48
|
+
zip?: string,
|
|
49
|
+
state?: string,
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
type phone = {
|
|
53
|
+
number?: string,
|
|
54
|
+
country_code?: string,
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
type addressDetails = {
|
|
58
|
+
address?: address,
|
|
59
|
+
email?: string,
|
|
60
|
+
phone?: phone,
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
type customerConfiguration = {
|
|
64
|
+
id?: string,
|
|
65
|
+
ephemeralKeySecret?: string,
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
type colors = {
|
|
69
|
+
primary?: string,
|
|
70
|
+
background?: string,
|
|
71
|
+
componentBackground?: string,
|
|
72
|
+
componentBorder?: string,
|
|
73
|
+
componentDivider?: string,
|
|
74
|
+
componentText?: string,
|
|
75
|
+
primaryText?: string,
|
|
76
|
+
secondaryText?: string,
|
|
77
|
+
placeholderText?: string,
|
|
78
|
+
icon?: string,
|
|
79
|
+
error?: string,
|
|
80
|
+
loaderBackground?: string,
|
|
81
|
+
loaderForeground?: string,
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
type colorType = {
|
|
85
|
+
light?: colors,
|
|
86
|
+
dark?: colors,
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// IOS Specific
|
|
90
|
+
type offsetType = {
|
|
91
|
+
x?: float,
|
|
92
|
+
y?: float,
|
|
93
|
+
}
|
|
94
|
+
type shadowConfig = {
|
|
95
|
+
color?: string,
|
|
96
|
+
opacity?: float,
|
|
97
|
+
blurRadius?: float,
|
|
98
|
+
offset?: offsetType,
|
|
99
|
+
intensity?: float,
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
type shapes = {
|
|
103
|
+
borderRadius?: float,
|
|
104
|
+
borderWidth?: float,
|
|
105
|
+
shadow?: shadowConfig, // IOS Specific
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
type font = {
|
|
109
|
+
family?: fontFamilyTypes,
|
|
110
|
+
scale?: float,
|
|
111
|
+
headingTextSizeAdjust?: float,
|
|
112
|
+
subHeadingTextSizeAdjust?: float,
|
|
113
|
+
placeholderTextSizeAdjust?: float,
|
|
114
|
+
buttonTextSizeAdjust?: float,
|
|
115
|
+
errorTextSizeAdjust?: float,
|
|
116
|
+
linkTextSizeAdjust?: float,
|
|
117
|
+
modalTextSizeAdjust?: float,
|
|
118
|
+
cardTextSizeAdjust?: float,
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
type primaryButtonColor = {
|
|
122
|
+
background?: string,
|
|
123
|
+
text?: string,
|
|
124
|
+
border?: string,
|
|
125
|
+
}
|
|
126
|
+
type primaryButtonColorType = {
|
|
127
|
+
light?: primaryButtonColor,
|
|
128
|
+
dark?: primaryButtonColor
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
type primaryButton = {
|
|
132
|
+
shapes?: shapes,
|
|
133
|
+
primaryButtonColor?: primaryButtonColorType,
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
type googlePayButtonType = BUY | BOOK | CHECKOUT | DONATE | ORDER | PAY | SUBSCRIBE | PLAIN
|
|
137
|
+
|
|
138
|
+
type googlePayButtonStyle = [#light | #dark]
|
|
139
|
+
|
|
140
|
+
type googlePayThemeBaseStyle = {
|
|
141
|
+
light?: googlePayButtonStyle,
|
|
142
|
+
dark?: googlePayButtonStyle,
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
type googlePayConfiguration = {
|
|
146
|
+
buttonType?: googlePayButtonType,
|
|
147
|
+
buttonStyle?: googlePayThemeBaseStyle,
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
type applePayButtonType = [
|
|
151
|
+
| #buy
|
|
152
|
+
| #setUp
|
|
153
|
+
| #inStore
|
|
154
|
+
| #donate
|
|
155
|
+
| #checkout
|
|
156
|
+
| #book
|
|
157
|
+
| #subscribe
|
|
158
|
+
| #plain
|
|
159
|
+
]
|
|
160
|
+
type applePayButtonStyle = [#white | #whiteOutline | #black]
|
|
161
|
+
|
|
162
|
+
type applePayThemeBaseStyle = {
|
|
163
|
+
light?: applePayButtonStyle,
|
|
164
|
+
dark?: applePayButtonStyle,
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
type applePayConfiguration = {
|
|
168
|
+
buttonType?: applePayButtonType,
|
|
169
|
+
buttonStyle?: applePayThemeBaseStyle,
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
type themeType =
|
|
173
|
+
| Default
|
|
174
|
+
| Light
|
|
175
|
+
| Dark
|
|
176
|
+
| Minimal
|
|
177
|
+
| FlatMinimal
|
|
178
|
+
|
|
179
|
+
type layoutType = [#tabs | #accordion | #spacedAccordion]
|
|
180
|
+
|
|
181
|
+
type appearance = {
|
|
182
|
+
locale?: localeTypes,
|
|
183
|
+
colors?: colorType,
|
|
184
|
+
shapes?: shapes,
|
|
185
|
+
font?: font,
|
|
186
|
+
primaryButton?: primaryButton,
|
|
187
|
+
googlePay?: googlePayConfiguration,
|
|
188
|
+
applePay?: applePayConfiguration,
|
|
189
|
+
theme?: themeType,
|
|
190
|
+
layout?: layoutType,
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
@genType
|
|
194
|
+
type options = {
|
|
195
|
+
allowsDelayedPaymentMethods?: bool,
|
|
196
|
+
appearance?: appearance,
|
|
197
|
+
shippingDetails?: addressDetails,
|
|
198
|
+
primaryButtonLabel?: string,
|
|
199
|
+
paymentSheetHeaderText?: string,
|
|
200
|
+
savedPaymentScreenHeaderText?: string,
|
|
201
|
+
merchantDisplayName?: string,
|
|
202
|
+
defaultBillingDetails?: addressDetails,
|
|
203
|
+
primaryButtonColor?: string,
|
|
204
|
+
allowsPaymentMethodsRequiringShippingAddress?: bool,
|
|
205
|
+
displaySavedPaymentMethodsCheckbox?: bool,
|
|
206
|
+
displaySavedPaymentMethods?: bool,
|
|
207
|
+
placeholder?: placeholder,
|
|
208
|
+
defaultView?: bool,
|
|
209
|
+
netceteraSDKApiKey?: string,
|
|
210
|
+
displayDefaultSavedPaymentIcon?: bool,
|
|
211
|
+
enablePartialLoading?: bool,
|
|
212
|
+
customer?: customerConfiguration,
|
|
213
|
+
paymentSheetHeaderLabel?: string,
|
|
214
|
+
savedPaymentSheetHeaderLabel?: string,
|
|
215
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/PaymentSheetConfiguration.res.js"],"mappings":"AAAA;AACA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* TypeScript file generated from HyperProvider.res by genType. */
|
|
4
|
+
|
|
5
|
+
/* eslint-disable */
|
|
6
|
+
/* tslint:disable */
|
|
7
|
+
|
|
8
|
+
import * as HyperProviderJS from './HyperProvider.res.js';
|
|
9
|
+
export const initHyperswitch = HyperProviderJS.initHyperswitch;
|
|
10
|
+
export const make = HyperProviderJS.make;
|
|
11
|
+
//# sourceMappingURL=HyperProvider.gen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["HyperProviderJS","initHyperswitch","make"],"sourceRoot":"../../../src","sources":["context/HyperProvider.gen.tsx"],"mappings":";;AAAA;;AAEA;AACA;;AAEA,OAAO,KAAKA,eAAe,MAAM,wBAAwB;AAYzD,OAAO,MAAMC,eAAyK,GAAGD,eAAe,CAACC,eAAsB;AAE/N,OAAO,MAAMC,IAMX,GAAGF,eAAe,CAACE,IAAW","ignoreList":[]}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
type hyperProviderData = {
|
|
2
|
+
publishableKey: string,
|
|
3
|
+
customBackendUrl?: string,
|
|
4
|
+
customLogUrl?: string,
|
|
5
|
+
customParams?: Js.Json.t,
|
|
6
|
+
isInitialized: bool,
|
|
7
|
+
error?: string,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let defaultVal: hyperProviderData = {
|
|
11
|
+
publishableKey: "",
|
|
12
|
+
isInitialized: false,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let hyperProviderContext = React.createContext((defaultVal, (_: hyperProviderData) => ()))
|
|
16
|
+
|
|
17
|
+
module Provider = {
|
|
18
|
+
let make = React.Context.provider(hyperProviderContext)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@genType
|
|
22
|
+
let initHyperswitch = (~publishableKey, ~customBackendUrl=?, ~customLogUrl=?, ~customParams=?) => {
|
|
23
|
+
NativeHyperswitchSdk.nativeHyperswitchSdk.initialise(
|
|
24
|
+
~publishableKey,
|
|
25
|
+
~customBackendUrl?,
|
|
26
|
+
~customLogUrl?,
|
|
27
|
+
~customParams?,
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@genType @react.component
|
|
32
|
+
let make = (
|
|
33
|
+
~children: React.element,
|
|
34
|
+
~publishableKey="",
|
|
35
|
+
~customBackendUrl=?,
|
|
36
|
+
~customLogUrl=?,
|
|
37
|
+
~customParams=?,
|
|
38
|
+
) => {
|
|
39
|
+
let (state, setState) = React.useState(_ => {
|
|
40
|
+
publishableKey,
|
|
41
|
+
?customBackendUrl,
|
|
42
|
+
?customLogUrl,
|
|
43
|
+
?customParams,
|
|
44
|
+
isInitialized: false,
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
let getError = (~error="Failed to initialize Hyperswitch") => {...state, error}
|
|
48
|
+
|
|
49
|
+
let initialise = async () => {
|
|
50
|
+
try {
|
|
51
|
+
let _ = await initHyperswitch(~publishableKey, ~customBackendUrl?, ~customLogUrl?, ~customParams?)
|
|
52
|
+
setState(_ => {
|
|
53
|
+
...state,
|
|
54
|
+
isInitialized:true,
|
|
55
|
+
})
|
|
56
|
+
} catch {
|
|
57
|
+
| Exn.Error(obj) =>
|
|
58
|
+
switch Exn.message(obj) {
|
|
59
|
+
| Some(error) => setState(_ => getError(~error))
|
|
60
|
+
| None => setState(_ => getError())
|
|
61
|
+
}
|
|
62
|
+
| _ => setState(_ => getError())
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
React.useEffect1(() => {
|
|
67
|
+
if (publishableKey != "") {
|
|
68
|
+
initialise()->ignore
|
|
69
|
+
}
|
|
70
|
+
None
|
|
71
|
+
}, [publishableKey])
|
|
72
|
+
|
|
73
|
+
let setState = React.useCallback1(val => {
|
|
74
|
+
setState(_ => val)
|
|
75
|
+
}, [setState])
|
|
76
|
+
|
|
77
|
+
<Provider value=(state, setState)> children </Provider>
|
|
78
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
4
|
+
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import * as Js_exn from "rescript/lib/es6/js_exn.js";
|
|
7
|
+
import * as Caml_obj from "rescript/lib/es6/caml_obj.js";
|
|
8
|
+
import * as JsxRuntime from "react/jsx-runtime";
|
|
9
|
+
import * as Caml_js_exceptions from "rescript/lib/es6/caml_js_exceptions.js";
|
|
10
|
+
import * as NativeHyperswitchSdk$JuspayTechReactNativeHyperswitch from "../modules/NativeHyperswitchSdk.res.js";
|
|
11
|
+
var defaultVal = {
|
|
12
|
+
publishableKey: "",
|
|
13
|
+
isInitialized: false
|
|
14
|
+
};
|
|
15
|
+
var hyperProviderContext = /*#__PURE__*/React.createContext([defaultVal, function (param) {}]);
|
|
16
|
+
var make = hyperProviderContext.Provider;
|
|
17
|
+
var Provider = {
|
|
18
|
+
make: make
|
|
19
|
+
};
|
|
20
|
+
function initHyperswitch(publishableKey, customBackendUrl, customLogUrl, customParams) {
|
|
21
|
+
return NativeHyperswitchSdk$JuspayTechReactNativeHyperswitch.nativeHyperswitchSdk.initialise(publishableKey, customBackendUrl, customLogUrl, customParams);
|
|
22
|
+
}
|
|
23
|
+
function HyperProvider(props) {
|
|
24
|
+
var customParams = props.customParams;
|
|
25
|
+
var customLogUrl = props.customLogUrl;
|
|
26
|
+
var customBackendUrl = props.customBackendUrl;
|
|
27
|
+
var __publishableKey = props.publishableKey;
|
|
28
|
+
var publishableKey = __publishableKey !== undefined ? __publishableKey : "";
|
|
29
|
+
var match = React.useState(function () {
|
|
30
|
+
return {
|
|
31
|
+
publishableKey: publishableKey,
|
|
32
|
+
customBackendUrl: customBackendUrl,
|
|
33
|
+
customLogUrl: customLogUrl,
|
|
34
|
+
customParams: customParams,
|
|
35
|
+
isInitialized: false
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
var setState = match[1];
|
|
39
|
+
var state = match[0];
|
|
40
|
+
var getError = function (errorOpt) {
|
|
41
|
+
var error = errorOpt !== undefined ? errorOpt : "Failed to initialize Hyperswitch";
|
|
42
|
+
var newrecord = Caml_obj.obj_dup(state);
|
|
43
|
+
newrecord.error = error;
|
|
44
|
+
return newrecord;
|
|
45
|
+
};
|
|
46
|
+
var initialise = async function () {
|
|
47
|
+
try {
|
|
48
|
+
await initHyperswitch(publishableKey, customBackendUrl, customLogUrl, customParams);
|
|
49
|
+
return setState(function (param) {
|
|
50
|
+
var newrecord = Caml_obj.obj_dup(state);
|
|
51
|
+
newrecord.isInitialized = true;
|
|
52
|
+
return newrecord;
|
|
53
|
+
});
|
|
54
|
+
} catch (raw_obj) {
|
|
55
|
+
var obj = Caml_js_exceptions.internalToOCamlException(raw_obj);
|
|
56
|
+
if (obj.RE_EXN_ID !== Js_exn.$$Error) {
|
|
57
|
+
return setState(function (param) {
|
|
58
|
+
return getError(undefined);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
var error = obj._1.message;
|
|
62
|
+
if (error !== undefined) {
|
|
63
|
+
return setState(function (param) {
|
|
64
|
+
return getError(error);
|
|
65
|
+
});
|
|
66
|
+
} else {
|
|
67
|
+
return setState(function (param) {
|
|
68
|
+
return getError(undefined);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
React.useEffect(function () {
|
|
74
|
+
if (publishableKey !== "") {
|
|
75
|
+
initialise();
|
|
76
|
+
}
|
|
77
|
+
}, [publishableKey]);
|
|
78
|
+
var setState$1 = React.useCallback(function (val) {
|
|
79
|
+
setState(function (param) {
|
|
80
|
+
return val;
|
|
81
|
+
});
|
|
82
|
+
}, [setState]);
|
|
83
|
+
return JsxRuntime.jsx(make, {
|
|
84
|
+
value: [state, setState$1],
|
|
85
|
+
children: props.children
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
var make$1 = HyperProvider;
|
|
89
|
+
export { defaultVal, hyperProviderContext, Provider, initHyperswitch, make$1 as make };
|
|
90
|
+
/* hyperProviderContext Not a pure module */
|
|
91
|
+
//# sourceMappingURL=HyperProvider.res.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Js_exn","Caml_obj","JsxRuntime","Caml_js_exceptions","NativeHyperswitchSdk$JuspayTechReactNativeHyperswitch","defaultVal","publishableKey","isInitialized","hyperProviderContext","createContext","param","make","Provider","initHyperswitch","customBackendUrl","customLogUrl","customParams","nativeHyperswitchSdk","initialise","HyperProvider","props","__publishableKey","undefined","match","useState","setState","state","getError","errorOpt","error","newrecord","obj_dup","raw_obj","obj","internalToOCamlException","RE_EXN_ID","$$Error","_1","message","useEffect","setState$1","useCallback","val","jsx","value","children","make$1"],"sourceRoot":"../../../src","sources":["context/HyperProvider.res.js"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/* TypeScript file generated from useHyper.res by genType. */
|
|
4
|
+
|
|
5
|
+
/* eslint-disable */
|
|
6
|
+
/* tslint:disable */
|
|
7
|
+
|
|
8
|
+
import * as useHyperJS from './useHyper.res.js';
|
|
9
|
+
export const useHyper = useHyperJS.useHyper;
|
|
10
|
+
//# sourceMappingURL=useHyper.gen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useHyperJS","useHyper"],"sourceRoot":"../../../src","sources":["hooks/useHyper.gen.tsx"],"mappings":";;AAAA;;AAEA;AACA;;AAEA,OAAO,KAAKA,UAAU,MAAM,mBAAmB;AAY/C,OAAO,MAAMC,QAAwB,GAAGD,UAAU,CAACC,QAAe","ignoreList":[]}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
open NativeHyperswitchSdk
|
|
2
|
+
|
|
3
|
+
let getError: (~error: string=?) => presentPaymentSheetResult = (
|
|
4
|
+
~error="Unknown error occurred while presenting payment sheet",
|
|
5
|
+
) => {
|
|
6
|
+
{
|
|
7
|
+
error: {
|
|
8
|
+
code: "failed",
|
|
9
|
+
message: error,
|
|
10
|
+
},
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let _initPaymentSession = async (params: initPaymentSessionParams): initPaymentSessionResult => {
|
|
15
|
+
try {
|
|
16
|
+
await nativeHyperswitchSdk.initPaymentSession(
|
|
17
|
+
~paymentIntentClientSecret=params.paymentIntentClientSecret->Option.getOr(""),
|
|
18
|
+
)
|
|
19
|
+
{}
|
|
20
|
+
} catch {
|
|
21
|
+
| Exn.Error(obj) =>
|
|
22
|
+
switch Exn.message(obj) {
|
|
23
|
+
| Some(msg) => {error: msg}
|
|
24
|
+
| None => {error: "Unknown error occurred while initializing payment sheet"}
|
|
25
|
+
}
|
|
26
|
+
| _ => {error: "Unexpected error occurred while initializing payment sheet"}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
let getData = (data, ~key : string, ~fallback : string)=>{
|
|
30
|
+
data
|
|
31
|
+
->Option.flatMap(obj =>
|
|
32
|
+
obj->Js.Dict.get(key)->Option.flatMap(json => json->Js.Json.decodeString)
|
|
33
|
+
)
|
|
34
|
+
->Option.getOr(fallback)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let parsePaymentSheetResult = (result: 'a): presentPaymentSheetResult => {
|
|
38
|
+
try {
|
|
39
|
+
let parsed = switch Js.typeof(result) {
|
|
40
|
+
| "string" => Js.Json.parseExn(result)
|
|
41
|
+
| _ => result->Obj.magic
|
|
42
|
+
}
|
|
43
|
+
let decodedObject = parsed->Js.Json.decodeObject
|
|
44
|
+
|
|
45
|
+
let status =
|
|
46
|
+
decodedObject->getData(~key="status", ~fallback="failed")
|
|
47
|
+
let errorMessage =
|
|
48
|
+
decodedObject->getData(~key="error", ~fallback="")
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
let code =
|
|
52
|
+
decodedObject->getData(~key="code", ~fallback="")
|
|
53
|
+
|
|
54
|
+
let typeData =
|
|
55
|
+
decodedObject->getData(~key="type", ~fallback="")
|
|
56
|
+
|
|
57
|
+
let message =
|
|
58
|
+
decodedObject
|
|
59
|
+
->getData(~key="message", ~fallback="failed")
|
|
60
|
+
|
|
61
|
+
let paymentResult = {
|
|
62
|
+
status,
|
|
63
|
+
message,
|
|
64
|
+
error: errorMessage,
|
|
65
|
+
\"type": typeData,
|
|
66
|
+
}
|
|
67
|
+
let error = {
|
|
68
|
+
code,
|
|
69
|
+
message: errorMessage,
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if errorMessage != "" {
|
|
73
|
+
{error, paymentResult}
|
|
74
|
+
} else {
|
|
75
|
+
{paymentResult: paymentResult}
|
|
76
|
+
}
|
|
77
|
+
} catch {
|
|
78
|
+
| _ => getError(~error="Failed to parse payment sheet result")
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
let _presentPaymentSheet = async (params: presentPaymentSheetParams): presentPaymentSheetResult => {
|
|
83
|
+
try {
|
|
84
|
+
let result = await nativeHyperswitchSdk.presentPaymentSheet(params)
|
|
85
|
+
result->parsePaymentSheetResult
|
|
86
|
+
} catch {
|
|
87
|
+
| Exn.Error(obj) =>
|
|
88
|
+
// Check if the error is an object error - if so, return the error
|
|
89
|
+
switch Js.typeof(obj) {
|
|
90
|
+
| "object" =>
|
|
91
|
+
// Try to parse the object error
|
|
92
|
+
try {
|
|
93
|
+
let errorObj = obj->Obj.magic
|
|
94
|
+
let parsedError = errorObj->parsePaymentSheetResult
|
|
95
|
+
parsedError
|
|
96
|
+
} catch {
|
|
97
|
+
| _ =>
|
|
98
|
+
switch Exn.message(obj) {
|
|
99
|
+
| Some(error) => getError(~error)
|
|
100
|
+
| None => getError()
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
| _ =>
|
|
104
|
+
switch Exn.message(obj) {
|
|
105
|
+
| Some(error) => getError(~error)
|
|
106
|
+
| None => getError()
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
| _ => getError()
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
type useHyper = {
|
|
114
|
+
initPaymentSession: initPaymentSessionParams => promise<initPaymentSessionResult>,
|
|
115
|
+
presentPaymentSheet: presentPaymentSheetParams => promise<presentPaymentSheetResult>,
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@genType
|
|
119
|
+
let useHyper = () => {
|
|
120
|
+
let (contextData, _) = React.useContext(HyperProvider.hyperProviderContext)
|
|
121
|
+
let isReady = contextData.isInitialized && contextData.error->Belt.Option.isNone
|
|
122
|
+
|
|
123
|
+
let initPaymentSession = React.useCallback0((params: initPaymentSessionParams) => {
|
|
124
|
+
_initPaymentSession(params)
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
let presentPaymentSheet = React.useCallback1((params: presentPaymentSheetParams) => {
|
|
128
|
+
if !isReady {
|
|
129
|
+
let a: promise<presentPaymentSheetResult> = Promise.resolve(
|
|
130
|
+
getError(~error="Hyperswitch is not initialized"),
|
|
131
|
+
)
|
|
132
|
+
a
|
|
133
|
+
} else {
|
|
134
|
+
_presentPaymentSheet(params)
|
|
135
|
+
}
|
|
136
|
+
}, [isReady])
|
|
137
|
+
|
|
138
|
+
{
|
|
139
|
+
initPaymentSession,
|
|
140
|
+
presentPaymentSheet,
|
|
141
|
+
}
|
|
142
|
+
}
|