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.
- package/HyperswitchSdkReactNative.podspec +42 -0
- package/LICENSE +201 -0
- package/android/build.gradle +161 -0
- package/android/gradle.properties +5 -0
- package/android/hyperswitch_autolinking.gradle +378 -0
- package/android/proguard-rules.pro +72 -0
- package/android/src/legacy/java/com/facebook/react/viewmanagers/GooglePayButtonManagerDelegate.java +41 -0
- package/android/src/legacy/java/com/facebook/react/viewmanagers/GooglePayButtonManagerInterface.java +20 -0
- package/android/src/legacy/java/com/facebook/react/viewmanagers/NativePaymentWidgetManagerDelegate.java +38 -0
- package/android/src/legacy/java/com/facebook/react/viewmanagers/NativePaymentWidgetManagerInterface.java +21 -0
- package/android/src/legacy/java/com/hyperswitchsdkreactnative/NativeHyperswitchSdkNativeSpec.java +106 -0
- package/android/src/legacy/java/com/hyperswitchsdkreactnative/NativeHyperswitchSdkReactNativeSpec.java +77 -0
- package/android/src/legacy/java/com/hyperswitchsdkreactnative/NativePaymentWidgetNativeSpec.java +36 -0
- package/android/src/main/AndroidManifest.xml +15 -0
- package/android/src/main/assets/hyperswitch.bundle +1535 -0
- package/android/src/main/java/com/hyperswitchsdkreactnative/HyperswitchSdkReactNativePackage.kt +47 -0
- package/android/src/main/java/com/hyperswitchsdkreactnative/modules/NativePaymentWidgetModule.kt +173 -0
- package/android/src/main/java/com/hyperswitchsdkreactnative/modules/ReactNativeHyperswitchModule.kt +396 -0
- package/android/src/main/java/com/hyperswitchsdkreactnative/views/PaymentElementViewManager.kt +99 -0
- package/android/src/main/java/io/hyperswitch/HyperswitchReactPackageProvider.kt +19 -0
- package/android/src/main/java/io/hyperswitch/PaymentEventType.kt +18 -0
- package/android/src/main/java/io/hyperswitch/model/ElementConfiguration.kt +58 -0
- package/android/src/main/java/io/hyperswitch/paymentsession/ExitHeadlessCallBackManager.kt +47 -0
- package/android/src/main/java/io/hyperswitch/paymentsession/GetPaymentSessionCallBackManager.kt +23 -0
- package/android/src/main/java/io/hyperswitch/paymentsession/PaymentMethod.kt +167 -0
- package/android/src/main/java/io/hyperswitch/paymentsession/PaymentSessionHandler.kt +68 -0
- package/android/src/main/java/io/hyperswitch/paymentsession/PaymentSessionHandlerImpl.kt +179 -0
- package/android/src/main/java/io/hyperswitch/paymentsession/PaymentSessionReactLauncher.kt +226 -0
- package/android/src/main/java/io/hyperswitch/paymentsession/PaymentSheetCallbackManager.kt +40 -0
- package/android/src/main/java/io/hyperswitch/paymentsheet/PaymentResult.kt +63 -0
- package/android/src/main/java/io/hyperswitch/react/GooglePayButtonManager.kt +54 -0
- package/android/src/main/java/io/hyperswitch/react/HyperActivity.kt +73 -0
- package/android/src/main/java/io/hyperswitch/react/HyperEventEmitter.kt +144 -0
- package/android/src/main/java/io/hyperswitch/react/HyperFragment.kt +429 -0
- package/android/src/main/java/io/hyperswitch/react/HyperFragmentManager.kt +155 -0
- package/android/src/main/java/io/hyperswitch/react/HyperHeadlessModule.kt +43 -0
- package/android/src/main/java/io/hyperswitch/react/HyperModule.kt +405 -0
- package/android/src/main/java/io/hyperswitch/react/HyperPackage.kt +16 -0
- package/android/src/main/java/io/hyperswitch/react/ReactNativeController.kt +251 -0
- package/android/src/main/java/io/hyperswitch/utils/ConversionUtils.kt +256 -0
- package/android/src/main/java/io/hyperswitch/utils/StandardResult.kt +45 -0
- package/android/src/main/java/io/hyperswitch/view/GooglePayButtonView.kt +59 -0
- package/android/src/main/java/io/hyperswitch/view/PaymentWidgetView.kt +405 -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/ReactNative/HyperswitchModule.swift +470 -0
- package/ios/Modules/ReactNative/HyperswitchSdkReactNative.h +5 -0
- package/ios/Modules/ReactNative/HyperswitchSdkReactNative.mm +121 -0
- package/ios/Modules/ReactNative/NativeHyperswitchModule.h +18 -0
- package/ios/Modules/ReactNative/NativeHyperswitchModule.mm +165 -0
- package/ios/Modules/ReactNative/NativeHyperswitchModuleImpl.swift +290 -0
- package/ios/Modules/ReactNative/NativePaymentElementModule.mm +129 -0
- package/ios/Views/Fabric/ApplePayView.h +14 -0
- package/ios/Views/Fabric/ApplePayView.mm +89 -0
- package/ios/Views/Fabric/NativePaymentElementView.h +21 -0
- package/ios/Views/Fabric/NativePaymentElementView.mm +200 -0
- package/ios/Views/Fabric/NativePaymentWidgetViewRegistry.h +37 -0
- package/ios/Views/Fabric/NativePaymentWidgetViewRegistry.m +45 -0
- package/ios/Views/Native/NativePaymentWidget.m +26 -0
- package/ios/Views/Native/NativePaymentWidget.swift +420 -0
- package/ios/hyperswitchSDK/Core/ApplePay/ApplePayHandler.swift +261 -0
- package/ios/hyperswitchSDK/Core/ApplePay/ApplePayViewManager.m +18 -0
- package/ios/hyperswitchSDK/Core/ApplePay/ApplePayViewManager.swift +126 -0
- package/ios/hyperswitchSDK/Core/DeviceDataCollection/HeadlessWebView.swift +144 -0
- package/ios/hyperswitchSDK/Core/HyperCVCWidget/CVCWidget.swift +136 -0
- package/ios/hyperswitchSDK/Core/HyperExpressCheckout/ExpressCheckoutLauncher.swift +116 -0
- package/ios/hyperswitchSDK/Core/HyperExpressCheckout/ExpressCheckoutWidget.swift +42 -0
- package/ios/hyperswitchSDK/Core/HyperPaymentCardTextField/PaymentCardTextField+SwiftUI.swift +67 -0
- package/ios/hyperswitchSDK/Core/HyperPaymentCardTextField/PaymentCardTextField.swift +44 -0
- package/ios/hyperswitchSDK/Core/HyperPaymentCardTextField/PaymentHandler.swift +59 -0
- package/ios/hyperswitchSDK/Core/HyperPaymentCardTextField/PaymentIntentParams.swift +31 -0
- package/ios/hyperswitchSDK/Core/HyperPaymentCardTextField/PaymentMethodParams.swift +25 -0
- package/ios/hyperswitchSDK/Core/HyperPaymentMethodManagement/PaymentManagementConfiguration.swift +213 -0
- package/ios/hyperswitchSDK/Core/HyperPaymentMethodManagement/PaymentMethodManagementWidget.swift +92 -0
- package/ios/hyperswitchSDK/Core/HyperPaymentSheet/PaymentSheet+Events.swift +36 -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 +68 -0
- package/ios/hyperswitchSDK/Core/HyperPaymentWidget/PaymentWidget.swift +212 -0
- package/ios/hyperswitchSDK/Core/HyperSession/PaymentSession+UIKit.swift +228 -0
- package/ios/hyperswitchSDK/Core/HyperSession/PaymentSessionTypes.swift +174 -0
- package/ios/hyperswitchSDK/Core/NativeModule/HyperHeadless.m +15 -0
- package/ios/hyperswitchSDK/Core/NativeModule/HyperHeadless.swift +108 -0
- package/ios/hyperswitchSDK/Core/NativeModule/HyperModule.m +31 -0
- package/ios/hyperswitchSDK/Core/NativeModule/HyperModule.swift +343 -0
- package/ios/hyperswitchSDK/Core/NativeModule/OTAServices.swift +117 -0
- package/ios/hyperswitchSDK/Core/NativeModule/RNHeadlessManager.swift +47 -0
- package/ios/hyperswitchSDK/Core/NativeModule/RNResponseHandler.swift +12 -0
- package/ios/hyperswitchSDK/Core/NativeModule/RNViewManager.swift +55 -0
- package/ios/hyperswitchSDK/Core/NativeModule/WidgetAction.swift +30 -0
- package/ios/hyperswitchSDK/Core/NativeModule/WidgetResponseRegistry.swift +92 -0
- package/ios/hyperswitchSDK/Core/NativeModule/hyper-Bridging-Header.h +12 -0
- package/ios/hyperswitchSDK/Core/Resources/HyperOTA.plist +20 -0
- package/ios/hyperswitchSDK/Core/Resources/hyperswitch.bundle +1531 -0
- package/ios/hyperswitchSDK/CoreLite/ApplePayHandlerLite.swift +251 -0
- package/ios/hyperswitchSDK/CoreLite/PaymentSession+Lite.swift +25 -0
- package/ios/hyperswitchSDK/CoreLite/PaymentSheetView+Lite.swift +45 -0
- package/ios/hyperswitchSDK/CoreLite/SwiftUI+Lite.swift +48 -0
- package/ios/hyperswitchSDK/CoreLite/WebViewController.swift +278 -0
- package/ios/hyperswitchSDK/Shared/APIClient.swift +22 -0
- package/ios/hyperswitchSDK/Shared/Codable+UIKit.swift +75 -0
- package/ios/hyperswitchSDK/Shared/CustomEndpointConfiguration.swift +67 -0
- package/ios/hyperswitchSDK/Shared/DictionaryConverter.swift +104 -0
- package/ios/hyperswitchSDK/Shared/Environment.swift +24 -0
- package/ios/hyperswitchSDK/Shared/Extensions.swift +101 -0
- package/ios/hyperswitchSDK/Shared/Helper.swift +40 -0
- package/ios/hyperswitchSDK/Shared/HyperEvents/PaymentEventData.swift +125 -0
- package/ios/hyperswitchSDK/Shared/HyperEvents/PaymentEventSubscriptionBuilder.swift +45 -0
- package/ios/hyperswitchSDK/Shared/HyperEvents/PaymentEventType.swift +30 -0
- package/ios/hyperswitchSDK/Shared/HyperNetworking.swift +151 -0
- package/ios/hyperswitchSDK/Shared/HyperParams.swift +44 -0
- package/ios/hyperswitchSDK/Shared/HyperUIViewController.swift +27 -0
- package/ios/hyperswitchSDK/Shared/Hyperswitch.swift +20 -0
- package/ios/hyperswitchSDK/Shared/HyperswitchConfigurationSchema.swift +54 -0
- package/ios/hyperswitchSDK/Shared/HyperswitchEnvironment.swift +11 -0
- package/ios/hyperswitchSDK/Shared/NativeLogger/Debouncer.swift +37 -0
- package/ios/hyperswitchSDK/Shared/NativeLogger/LogBuilder.swift +113 -0
- package/ios/hyperswitchSDK/Shared/NativeLogger/LogFileManager.swift +76 -0
- package/ios/hyperswitchSDK/Shared/NativeLogger/LogManager.swift +113 -0
- package/ios/hyperswitchSDK/Shared/NativeLogger/LogPayload.swift +91 -0
- package/ios/hyperswitchSDK/Shared/PaymentMethodType.swift +15 -0
- package/ios/hyperswitchSDK/Shared/PaymentSession.swift +98 -0
- package/ios/hyperswitchSDK/Shared/PaymentSessionConfiguration.swift +14 -0
- package/ios/hyperswitchSDK/Shared/PaymentSheet.swift +33 -0
- package/ios/hyperswitchSDK/Shared/PaymentSheetAppearance+Codable.swift +182 -0
- package/ios/hyperswitchSDK/Shared/PaymentSheetAppearance.swift +238 -0
- package/ios/hyperswitchSDK/Shared/PaymentSheetConfiguration.swift +161 -0
- package/ios/hyperswitchSDK/Shared/SDKParams.swift +43 -0
- package/ios/hyperswitchSDK/Shared/SavedPaymentMethodsConfiguration.swift +20 -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 +0 -0
- package/lib/bs/build.ninja +8 -0
- package/lib/bs/install.ninja +9 -0
- package/lib/bs/src/context/HyperProvider-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/context/WidgetRegistry-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/core/Hyper-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/core/HyperElements-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/hooks/usePaymentSession-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/hooks/useWidget-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/modules/NativeHyperswitchSdk-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/types/HyperTypes-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/types/NativeModuleTypes-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/types/PaymentSheetConfiguration-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/utils/AppearanceTransformer-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/utils/EventValidator-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/utils/NewArchUtils-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/utils/PaymentSheetEventManager-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/utils/ReactNativeUtils-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/utils/ResponseHandler-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/views/CVCElement-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/views/NativePaymentWidget-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/views/NativePaymentWidgetImpl-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/bs/src/views/PaymentElement-JuspayTechReactNativeHyperswitch.cmt +0 -0
- package/lib/commonjs/index.bundle.js +2 -0
- package/lib/commonjs/index.bundle.js.map +1 -0
- package/lib/module/index.bundle.js +2 -0
- package/lib/module/index.bundle.js.map +1 -0
- package/lib/typescript/babel.config.d.ts +10 -0
- package/lib/typescript/babel.config.d.ts.map +1 -0
- package/lib/typescript/eslint.config.d.mts +3 -0
- package/lib/typescript/eslint.config.d.mts.map +1 -0
- package/lib/typescript/rollup.config.d.ts +23 -0
- package/lib/typescript/rollup.config.d.ts.map +1 -0
- package/lib/typescript/scripts/bootstrap.d.ts +2 -0
- package/lib/typescript/scripts/bootstrap.d.ts.map +1 -0
- package/lib/typescript/src/context/Elements.d.ts +7 -0
- package/lib/typescript/src/context/Elements.d.ts.map +1 -0
- package/lib/typescript/src/context/HyperElements.d.ts +23 -0
- package/lib/typescript/src/context/HyperElements.d.ts.map +1 -0
- package/lib/typescript/src/context/PaymentSession.d.ts +15 -0
- package/lib/typescript/src/context/PaymentSession.d.ts.map +1 -0
- package/lib/typescript/src/context/SavedPaymentMethods.d.ts +5 -0
- package/lib/typescript/src/context/SavedPaymentMethods.d.ts.map +1 -0
- package/lib/typescript/src/context/WidgetRegistry.d.ts +8 -0
- package/lib/typescript/src/context/WidgetRegistry.d.ts.map +1 -0
- package/lib/typescript/src/context/hooks.d.ts +5 -0
- package/lib/typescript/src/context/hooks.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +10 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/modules/NativeHyperswitchSdk.d.ts +61 -0
- package/lib/typescript/src/modules/NativeHyperswitchSdk.d.ts.map +1 -0
- package/lib/typescript/src/specs/ApplePayViewNativeComponent.d.ts +10 -0
- package/lib/typescript/src/specs/ApplePayViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeHyperHeadless.d.ts +14 -0
- package/lib/typescript/src/specs/NativeHyperHeadless.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeHyperswitchModule.d.ts +32 -0
- package/lib/typescript/src/specs/NativeHyperswitchModule.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeHyperswitchSdkNative.d.ts +33 -0
- package/lib/typescript/src/specs/NativeHyperswitchSdkNative.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativePaymentElementModule.d.ts +9 -0
- package/lib/typescript/src/specs/NativePaymentElementModule.d.ts.map +1 -0
- package/lib/typescript/src/specs/PaymentElementNativeComponent.d.ts +19 -0
- package/lib/typescript/src/specs/PaymentElementNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/specs/utils.d.ts +15 -0
- package/lib/typescript/src/specs/utils.d.ts.map +1 -0
- package/lib/typescript/src/types/NativeModuleTypes.d.ts +67 -0
- package/lib/typescript/src/types/NativeModuleTypes.d.ts.map +1 -0
- package/lib/typescript/src/types/PaymentSheetConfiguration.d.ts +255 -0
- package/lib/typescript/src/types/PaymentSheetConfiguration.d.ts.map +1 -0
- package/lib/typescript/src/types/definitions.d.ts +85 -0
- package/lib/typescript/src/types/definitions.d.ts.map +1 -0
- package/lib/typescript/src/types/elements/index.d.ts +23 -0
- package/lib/typescript/src/types/elements/index.d.ts.map +1 -0
- package/lib/typescript/src/types/paymentresult/index.d.ts +5 -0
- package/lib/typescript/src/types/paymentresult/index.d.ts.map +1 -0
- package/lib/typescript/src/types/savedPaymentMethods/index.d.ts +69 -0
- package/lib/typescript/src/types/savedPaymentMethods/index.d.ts.map +1 -0
- package/lib/typescript/src/utils/EventValidator.d.ts +9 -0
- package/lib/typescript/src/utils/EventValidator.d.ts.map +1 -0
- package/lib/typescript/src/utils/InitializationState.d.ts +13 -0
- package/lib/typescript/src/utils/InitializationState.d.ts.map +1 -0
- package/lib/typescript/src/utils/LaunchOptions.d.ts +7 -0
- package/lib/typescript/src/utils/LaunchOptions.d.ts.map +1 -0
- package/lib/typescript/src/utils/NewArchUtils.d.ts +7 -0
- package/lib/typescript/src/utils/NewArchUtils.d.ts.map +1 -0
- package/lib/typescript/src/utils/ReactNativeUtils.d.ts +3 -0
- package/lib/typescript/src/utils/ReactNativeUtils.d.ts.map +1 -0
- package/lib/typescript/src/views/CVCElement.d.ts +15 -0
- package/lib/typescript/src/views/CVCElement.d.ts.map +1 -0
- package/lib/typescript/src/views/NativePaymentWidget.d.ts +3 -0
- package/lib/typescript/src/views/NativePaymentWidget.d.ts.map +1 -0
- package/lib/typescript/src/views/NativePaymentWidgetImpl.d.ts +5 -0
- package/lib/typescript/src/views/NativePaymentWidgetImpl.d.ts.map +1 -0
- package/lib/typescript/src/views/PaymentElement.d.ts +18 -0
- package/lib/typescript/src/views/PaymentElement.d.ts.map +1 -0
- package/package.json +184 -0
- package/src/context/Elements.ts +80 -0
- package/src/context/HyperElements.tsx +81 -0
- package/src/context/PaymentSession.ts +121 -0
- package/src/context/SavedPaymentMethods.ts +80 -0
- package/src/context/WidgetRegistry.ts +74 -0
- package/src/context/hooks.ts +79 -0
- package/src/index.ts +53 -0
- package/src/modules/NativeHyperswitchSdk.ts +155 -0
- package/src/specs/ApplePayViewNativeComponent.ts +11 -0
- package/src/specs/NativeHyperHeadless.ts +22 -0
- package/src/specs/NativeHyperswitchModule.ts +51 -0
- package/src/specs/NativeHyperswitchSdkNative.ts +62 -0
- package/src/specs/NativePaymentElementModule.ts +25 -0
- package/src/specs/PaymentElementNativeComponent.ts +21 -0
- package/src/specs/utils.ts +15 -0
- package/src/types/NativeModuleTypes.ts +73 -0
- package/src/types/PaymentSheetConfiguration.ts +360 -0
- package/src/types/definitions.ts +109 -0
- package/src/types/elements/index.ts +33 -0
- package/src/types/paymentresult/index.ts +4 -0
- package/src/types/savedPaymentMethods/index.ts +74 -0
- package/src/utils/EventValidator.ts +39 -0
- package/src/utils/InitializationState.ts +28 -0
- package/src/utils/LaunchOptions.ts +41 -0
- package/src/utils/NewArchUtils.ts +18 -0
- package/src/utils/ReactNativeUtils.ts +13 -0
- package/src/views/CVCElement.tsx +122 -0
- package/src/views/NativePaymentWidget.ts +2 -0
- package/src/views/NativePaymentWidgetImpl.ts +16 -0
- package/src/views/PaymentElement.tsx +189 -0
- package/tsconfig.build.json +21 -0
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import groovy.json.JsonSlurper
|
|
2
|
+
import groovy.text.SimpleTemplateEngine
|
|
3
|
+
|
|
4
|
+
def generatedClassName = "HyperPackageList"
|
|
5
|
+
def generatedFilePackage = "com.facebook.react"
|
|
6
|
+
|
|
7
|
+
def generatedFileContentsTemplate = """
|
|
8
|
+
package $generatedFilePackage;
|
|
9
|
+
|
|
10
|
+
import android.app.Application;
|
|
11
|
+
import android.content.Context;
|
|
12
|
+
import android.content.res.Resources;
|
|
13
|
+
|
|
14
|
+
import com.facebook.react.ReactPackage;
|
|
15
|
+
import com.facebook.react.shell.MainPackageConfig;
|
|
16
|
+
import com.facebook.react.shell.MainReactPackage;
|
|
17
|
+
import java.util.Arrays;
|
|
18
|
+
import java.util.ArrayList;
|
|
19
|
+
|
|
20
|
+
{{ packageImports }}
|
|
21
|
+
|
|
22
|
+
public class $generatedClassName {
|
|
23
|
+
private Application application;
|
|
24
|
+
private ReactNativeHost reactNativeHost;
|
|
25
|
+
private MainPackageConfig mConfig;
|
|
26
|
+
|
|
27
|
+
public $generatedClassName(ReactNativeHost reactNativeHost) {
|
|
28
|
+
this(reactNativeHost, null);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public $generatedClassName(Application application) {
|
|
32
|
+
this(application, null);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public $generatedClassName(ReactNativeHost reactNativeHost, MainPackageConfig config) {
|
|
36
|
+
this.reactNativeHost = reactNativeHost;
|
|
37
|
+
mConfig = config;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public $generatedClassName(Application application, MainPackageConfig config) {
|
|
41
|
+
this.reactNativeHost = null;
|
|
42
|
+
this.application = application;
|
|
43
|
+
mConfig = config;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
private ReactNativeHost getReactNativeHost() {
|
|
47
|
+
return this.reactNativeHost;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
private Resources getResources() {
|
|
51
|
+
return this.getApplication().getResources();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
private Application getApplication() {
|
|
55
|
+
if (this.reactNativeHost == null) return this.application;
|
|
56
|
+
return this.reactNativeHost.getApplication();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
private Context getApplicationContext() {
|
|
60
|
+
return this.getApplication().getApplicationContext();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public ArrayList<ReactPackage> getPackages() {
|
|
64
|
+
return new ArrayList<>(Arrays.<ReactPackage>asList(
|
|
65
|
+
new MainReactPackage(mConfig){{ packageClassInstances }}
|
|
66
|
+
));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
"""
|
|
70
|
+
|
|
71
|
+
class HyperswitchAutolinking {
|
|
72
|
+
private Logger logger
|
|
73
|
+
private String packageName
|
|
74
|
+
private File root
|
|
75
|
+
private Project rootProject
|
|
76
|
+
private ArrayList<HashMap<String, String>> reactNativeModules
|
|
77
|
+
private HashMap<String, ArrayList> reactNativeModulesBuildVariants
|
|
78
|
+
private static String LOG_PREFIX = ":HyperswitchSDK:"
|
|
79
|
+
|
|
80
|
+
HyperswitchAutolinking(Logger logger, File root, Project rootProject) {
|
|
81
|
+
this.logger = logger
|
|
82
|
+
this.root = root
|
|
83
|
+
this.rootProject = rootProject
|
|
84
|
+
this.packageName = "com.hyperswitchsdkreactnative"
|
|
85
|
+
|
|
86
|
+
def (nativeModules, reactNativeModulesBuildVariants) = this.loadAutolinkingData()
|
|
87
|
+
this.reactNativeModules = nativeModules
|
|
88
|
+
this.reactNativeModulesBuildVariants = reactNativeModulesBuildVariants
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Load autolinking data with primary/fallback strategy
|
|
93
|
+
* Primary: autolinking.json from rootProject build directory
|
|
94
|
+
* Fallback: React Native CLI (for RN < 0.76)
|
|
95
|
+
*/
|
|
96
|
+
private ArrayList loadAutolinkingData() {
|
|
97
|
+
try {
|
|
98
|
+
return loadFromAutolinkingJson()
|
|
99
|
+
} catch (Exception e) {
|
|
100
|
+
this.logger.warn("${LOG_PREFIX}Failed to load autolinking.json: ${e.message}")
|
|
101
|
+
this.logger.info("${LOG_PREFIX}Falling back to React Native CLI approach")
|
|
102
|
+
return loadFromReactNativeCli()
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Primary: Load from autolinking.json (RN >= 0.76)
|
|
108
|
+
*/
|
|
109
|
+
private ArrayList loadFromAutolinkingJson() {
|
|
110
|
+
def autolinkingFile = new File(rootProject.layout.buildDirectory.get().asFile, "generated/autolinking/autolinking.json")
|
|
111
|
+
|
|
112
|
+
if (!autolinkingFile.exists()) {
|
|
113
|
+
throw new FileNotFoundException("autolinking.json not found at: ${autolinkingFile.absolutePath}")
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
this.logger.info("${LOG_PREFIX}Reading autolinking configuration from: ${autolinkingFile.absolutePath}")
|
|
117
|
+
|
|
118
|
+
def json = new JsonSlurper().parse(autolinkingFile)
|
|
119
|
+
def dependencies = json["dependencies"]
|
|
120
|
+
|
|
121
|
+
if (!dependencies) {
|
|
122
|
+
throw new IllegalStateException("No dependencies found in autolinking.json")
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
ArrayList<HashMap<String, String>> reactNativeModules = new ArrayList<HashMap<String, String>>()
|
|
126
|
+
HashMap<String, ArrayList> reactNativeModulesBuildVariants = new HashMap<String, ArrayList>()
|
|
127
|
+
|
|
128
|
+
dependencies.each { name, value ->
|
|
129
|
+
def platformsConfig = value["platforms"]
|
|
130
|
+
def androidConfig = platformsConfig["android"]
|
|
131
|
+
|
|
132
|
+
if (androidConfig != null && androidConfig["sourceDir"] != null && !androidConfig["isPureCxxDependency"]) {
|
|
133
|
+
this.logger.info("${LOG_PREFIX}Adding native module '${name}' from autolinking.json")
|
|
134
|
+
|
|
135
|
+
HashMap reactNativeModuleConfig = new HashMap<String, String>()
|
|
136
|
+
def nameCleansed = name.replaceAll('[~*!\'()]+', '_').replaceAll('^@([\\w-.]+)/', '$1_')
|
|
137
|
+
|
|
138
|
+
reactNativeModuleConfig.put("name", name)
|
|
139
|
+
reactNativeModuleConfig.put("nameCleansed", nameCleansed)
|
|
140
|
+
reactNativeModuleConfig.put("androidSourceDir", androidConfig["sourceDir"])
|
|
141
|
+
reactNativeModuleConfig.put("packageInstance", androidConfig["packageInstance"])
|
|
142
|
+
reactNativeModuleConfig.put("packageImportPath", androidConfig["packageImportPath"])
|
|
143
|
+
reactNativeModuleConfig.put("libraryName", androidConfig["libraryName"])
|
|
144
|
+
reactNativeModuleConfig.put("componentDescriptors", androidConfig["componentDescriptors"])
|
|
145
|
+
|
|
146
|
+
if (androidConfig["buildTypes"] && !androidConfig["buildTypes"].isEmpty()) {
|
|
147
|
+
reactNativeModulesBuildVariants.put(nameCleansed, androidConfig["buildTypes"])
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (androidConfig.containsKey("dependencyConfiguration")) {
|
|
151
|
+
reactNativeModuleConfig.put("dependencyConfiguration", androidConfig["dependencyConfiguration"])
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
reactNativeModules.add(reactNativeModuleConfig)
|
|
155
|
+
} else {
|
|
156
|
+
this.logger.debug("${LOG_PREFIX}Skipping native module '${name}' (no Android config or pure C++)")
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
this.logger.info("${LOG_PREFIX}Loaded ${reactNativeModules.size()} modules from autolinking.json")
|
|
161
|
+
return [reactNativeModules, reactNativeModulesBuildVariants]
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Fallback: Load from React Native CLI (RN < 0.76)
|
|
166
|
+
*/
|
|
167
|
+
private ArrayList loadFromReactNativeCli() {
|
|
168
|
+
this.logger.info("${LOG_PREFIX}Using React Native CLI fallback")
|
|
169
|
+
|
|
170
|
+
ArrayList<HashMap<String, String>> reactNativeModules = new ArrayList<HashMap<String, String>>()
|
|
171
|
+
HashMap<String, ArrayList> reactNativeModulesBuildVariants = new HashMap<String, ArrayList>()
|
|
172
|
+
|
|
173
|
+
try {
|
|
174
|
+
def cliResolveScript = "try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}"
|
|
175
|
+
String[] nodeCommand = ["node", "-e", cliResolveScript]
|
|
176
|
+
def cliPath = this.getCommandOutput(nodeCommand, this.root)
|
|
177
|
+
|
|
178
|
+
String[] reactNativeConfigCommand = ["node", cliPath, "config"]
|
|
179
|
+
def reactNativeConfigOutput = this.getCommandOutput(reactNativeConfigCommand, this.root)
|
|
180
|
+
|
|
181
|
+
def json = new JsonSlurper().parseText(reactNativeConfigOutput)
|
|
182
|
+
def dependencies = json["dependencies"]
|
|
183
|
+
def project = json["project"]["android"]
|
|
184
|
+
|
|
185
|
+
if (project == null) {
|
|
186
|
+
throw new Exception("React Native CLI failed to determine Android project configuration")
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
def engine = new SimpleTemplateEngine()
|
|
190
|
+
|
|
191
|
+
dependencies.each { name, value ->
|
|
192
|
+
def platformsConfig = value["platforms"]
|
|
193
|
+
def androidConfig = platformsConfig["android"]
|
|
194
|
+
|
|
195
|
+
if (androidConfig != null && androidConfig["sourceDir"] != null) {
|
|
196
|
+
this.logger.info("${LOG_PREFIX}Adding native module '${name}' from CLI")
|
|
197
|
+
|
|
198
|
+
HashMap reactNativeModuleConfig = new HashMap<String, String>()
|
|
199
|
+
def nameCleansed = name.replaceAll('[~*!\'()]+', '_').replaceAll('^@([\\w-.]+)/', '$1_')
|
|
200
|
+
|
|
201
|
+
reactNativeModuleConfig.put("name", name)
|
|
202
|
+
reactNativeModuleConfig.put("nameCleansed", nameCleansed)
|
|
203
|
+
reactNativeModuleConfig.put("androidSourceDir", androidConfig["sourceDir"])
|
|
204
|
+
reactNativeModuleConfig.put("packageInstance", androidConfig["packageInstance"])
|
|
205
|
+
reactNativeModuleConfig.put("packageImportPath", androidConfig["packageImportPath"])
|
|
206
|
+
reactNativeModuleConfig.put("libraryName", androidConfig["libraryName"])
|
|
207
|
+
reactNativeModuleConfig.put("componentDescriptors", androidConfig["componentDescriptors"])
|
|
208
|
+
|
|
209
|
+
if (androidConfig["buildTypes"] && !androidConfig["buildTypes"].isEmpty()) {
|
|
210
|
+
reactNativeModulesBuildVariants.put(nameCleansed, androidConfig["buildTypes"])
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (androidConfig.containsKey("dependencyConfiguration")) {
|
|
214
|
+
reactNativeModuleConfig.put("dependencyConfiguration", androidConfig["dependencyConfiguration"])
|
|
215
|
+
} else if (project.containsKey("dependencyConfiguration")) {
|
|
216
|
+
def bindings = ["dependencyName": nameCleansed]
|
|
217
|
+
def template = engine.createTemplate(project["dependencyConfiguration"]).make(bindings)
|
|
218
|
+
reactNativeModuleConfig.put("dependencyConfiguration", template.toString())
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
reactNativeModules.add(reactNativeModuleConfig)
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
this.logger.info("${LOG_PREFIX}Loaded ${reactNativeModules.size()} modules from React Native CLI")
|
|
226
|
+
return [reactNativeModules, reactNativeModulesBuildVariants]
|
|
227
|
+
|
|
228
|
+
} catch (Exception e) {
|
|
229
|
+
this.logger.error("${LOG_PREFIX}React Native CLI fallback failed: ${e.message}")
|
|
230
|
+
throw new Exception("Both autolinking.json and React Native CLI failed. Please ensure React Native is properly configured.")
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Add dynamic dependencies to the project
|
|
236
|
+
*/
|
|
237
|
+
void addReactNativeModuleDependencies(Project project) {
|
|
238
|
+
this.logger.info("${LOG_PREFIX}Adding ${reactNativeModules.size()} dynamic dependencies")
|
|
239
|
+
|
|
240
|
+
reactNativeModules.forEach { reactNativeModule ->
|
|
241
|
+
def nameCleansed = reactNativeModule["nameCleansed"]
|
|
242
|
+
def dependencyConfiguration = reactNativeModule["dependencyConfiguration"]
|
|
243
|
+
|
|
244
|
+
project.dependencies {
|
|
245
|
+
if (reactNativeModulesBuildVariants.containsKey(nameCleansed)) {
|
|
246
|
+
reactNativeModulesBuildVariants
|
|
247
|
+
.get(nameCleansed)
|
|
248
|
+
.forEach { buildVariant ->
|
|
249
|
+
if (dependencyConfiguration != null) {
|
|
250
|
+
add("${buildVariant}${dependencyConfiguration}", project.project(":${nameCleansed}"))
|
|
251
|
+
} else {
|
|
252
|
+
add("${buildVariant}Implementation", project.project(":${nameCleansed}"))
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
} else {
|
|
256
|
+
if(nameCleansed != "juspay-tech_react-native-hyperswitch") {
|
|
257
|
+
if (dependencyConfiguration != null) {
|
|
258
|
+
add("${dependencyConfiguration}", project.project(":${nameCleansed}"))
|
|
259
|
+
} else {
|
|
260
|
+
implementation project.project(":${nameCleansed}")
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
this.logger.debug("${LOG_PREFIX}Added dependency: ${nameCleansed}")
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Generate PackageList.java file
|
|
272
|
+
*/
|
|
273
|
+
void generatePackagesFile(File outputDir, String generatedFileName, String generatedFileContentsTemplate) {
|
|
274
|
+
ArrayList<HashMap<String, String>> packages = this.reactNativeModules
|
|
275
|
+
String packageName = this.packageName
|
|
276
|
+
String packageImports = ""
|
|
277
|
+
String packageClassInstances = ""
|
|
278
|
+
|
|
279
|
+
if (packages.size() > 0) {
|
|
280
|
+
def interpolateDynamicValues = { input ->
|
|
281
|
+
input.replaceAll(~/([^.\w])(BuildConfig|R)([^\w])/) { wholeString, prefix, className, suffix ->
|
|
282
|
+
"${prefix}${packageName}.${className}${suffix}"
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
packageImports = packages.collect {
|
|
287
|
+
"// ${it.name}\n${interpolateDynamicValues(it.packageImportPath)}"
|
|
288
|
+
}.join('\n')
|
|
289
|
+
|
|
290
|
+
packageClassInstances = ",\n " + packages.collect {
|
|
291
|
+
interpolateDynamicValues(it.packageInstance)
|
|
292
|
+
}.join(",\n ")
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
String generatedFileContents = generatedFileContentsTemplate
|
|
296
|
+
.replace("{{ packageImports }}", packageImports)
|
|
297
|
+
.replace("{{ packageClassInstances }}", packageClassInstances)
|
|
298
|
+
|
|
299
|
+
outputDir.mkdirs()
|
|
300
|
+
final FileTreeBuilder treeBuilder = new FileTreeBuilder(outputDir)
|
|
301
|
+
treeBuilder.file(generatedFileName).newWriter().withWriter { w ->
|
|
302
|
+
w << generatedFileContents
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
this.logger.info("${LOG_PREFIX}Generated PackageList.java with ${packages.size()} packages")
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Execute command and return output
|
|
310
|
+
*/
|
|
311
|
+
private String getCommandOutput(String[] command, File directory) {
|
|
312
|
+
try {
|
|
313
|
+
def cmdProcess = Runtime.getRuntime().exec(command, null, directory)
|
|
314
|
+
def bufferedReader = new BufferedReader(new InputStreamReader(cmdProcess.getInputStream()))
|
|
315
|
+
def readBuffer = new StringBuffer()
|
|
316
|
+
def buff = ""
|
|
317
|
+
|
|
318
|
+
while ((buff = bufferedReader.readLine()) != null) {
|
|
319
|
+
readBuffer.append(buff)
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
def output = readBuffer.toString()
|
|
323
|
+
if (!output) {
|
|
324
|
+
def bufferedErrorReader = new BufferedReader(new InputStreamReader(cmdProcess.getErrorStream()))
|
|
325
|
+
def readErrorBuffer = new StringBuffer()
|
|
326
|
+
def errBuff = ""
|
|
327
|
+
|
|
328
|
+
while ((errBuff = bufferedErrorReader.readLine()) != null) {
|
|
329
|
+
readErrorBuffer.append(errBuff)
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
throw new Exception("Command failed: ${readErrorBuffer.toString()}")
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
return output
|
|
336
|
+
} catch (Exception exception) {
|
|
337
|
+
this.logger.error("${LOG_PREFIX}Command execution failed: ${exception.message}")
|
|
338
|
+
throw exception
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
def projectRoot = rootProject.projectDir
|
|
344
|
+
def hyperswitchAutolinking = new HyperswitchAutolinking(logger, projectRoot, rootProject)
|
|
345
|
+
|
|
346
|
+
ext.applyHyperswitchAutolinking = { Project project ->
|
|
347
|
+
// Add dynamic dependencies
|
|
348
|
+
hyperswitchAutolinking.addReactNativeModuleDependencies(project)
|
|
349
|
+
|
|
350
|
+
// Setup generation paths
|
|
351
|
+
def generatedSrcDir = new File(project.layout.buildDirectory.get().asFile, "generated/source/packagelist")
|
|
352
|
+
def generatedCodeDir = new File(generatedSrcDir, generatedFilePackage.replace('.', '/'))
|
|
353
|
+
|
|
354
|
+
// Create the generation task
|
|
355
|
+
project.tasks.register('generatePackageList') {
|
|
356
|
+
group = "hyperswitch"
|
|
357
|
+
description = "Generates PackageList.java for Hyperswitch SDK"
|
|
358
|
+
|
|
359
|
+
outputs.dir(generatedCodeDir)
|
|
360
|
+
outputs.upToDateWhen { false }
|
|
361
|
+
|
|
362
|
+
doLast {
|
|
363
|
+
hyperswitchAutolinking.generatePackagesFile(generatedCodeDir, "${generatedClassName}.java", generatedFileContentsTemplate)
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
project.preBuild.dependsOn project.generatePackageList
|
|
368
|
+
|
|
369
|
+
project.android {
|
|
370
|
+
sourceSets {
|
|
371
|
+
main {
|
|
372
|
+
java {
|
|
373
|
+
srcDirs += generatedSrcDir
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Hyperswitch SDK ProGuard Rules
|
|
2
|
+
|
|
3
|
+
# Keep public classes and methods that are part of the SDK API
|
|
4
|
+
-keep public class com.hyperswitchsdkreactnative.** {
|
|
5
|
+
public *;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
# Keep React Native module classes
|
|
9
|
+
-keep class com.hyperswitchsdkreactnative.modules.** { *; }
|
|
10
|
+
-keep class com.hyperswitchsdkreactnative.provider.** { *; }
|
|
11
|
+
-keep class com.hyperswitchsdkreactnative.gpay.** { *; }
|
|
12
|
+
-keep class com.hyperswitchsdkreactnative.utils.** { *; }
|
|
13
|
+
|
|
14
|
+
# Keep annotation classes
|
|
15
|
+
-keepattributes *Annotation*
|
|
16
|
+
-keepattributes RuntimeVisibleAnnotations
|
|
17
|
+
-keepattributes RuntimeInvisibleAnnotations
|
|
18
|
+
|
|
19
|
+
# Keep Kotlin metadata
|
|
20
|
+
-keep class kotlin.Metadata { *; }
|
|
21
|
+
-keep class kotlin.jvm.internal.Intrinsics { *; }
|
|
22
|
+
|
|
23
|
+
# Keep React Native classes
|
|
24
|
+
-keep class com.facebook.react.** { *; }
|
|
25
|
+
-keep class com.facebook.react.bridge.** { *; }
|
|
26
|
+
-keep class com.facebook.react.uimanager.** { *; }
|
|
27
|
+
|
|
28
|
+
# Keep Google Pay classes
|
|
29
|
+
-keep class com.google.android.gms.wallet.** { *; }
|
|
30
|
+
-keep class com.google.android.gms.common.api.** { *; }
|
|
31
|
+
|
|
32
|
+
# Keep AndroidX classes that are commonly used
|
|
33
|
+
-keep class androidx.lifecycle.** { *; }
|
|
34
|
+
-keep class androidx.fragment.** { *; }
|
|
35
|
+
-keep class androidx.activity.** { *; }
|
|
36
|
+
|
|
37
|
+
# Keep enum classes
|
|
38
|
+
-keepclassmembers enum * {
|
|
39
|
+
public static **[] values();
|
|
40
|
+
public static ** valueOf(java.lang.String);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
# Keep serializable classes
|
|
44
|
+
-keepnames class * implements java.io.Serializable
|
|
45
|
+
-keepclassmembers class * implements java.io.Serializable {
|
|
46
|
+
static final long serialVersionUID;
|
|
47
|
+
private static final java.io.ObjectStreamField[] serialPersistentFields;
|
|
48
|
+
!static !transient <fields>;
|
|
49
|
+
!private <methods>;
|
|
50
|
+
private void writeObject(java.io.ObjectOutputStream);
|
|
51
|
+
private void readObject(java.io.ObjectInputStream);
|
|
52
|
+
java.lang.Object writeReplace();
|
|
53
|
+
java.lang.Object readResolve();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
# Keep callback methods
|
|
57
|
+
-keepclassmembers class * {
|
|
58
|
+
@android.webkit.JavascriptInterface <methods>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
# Keep promise-related classes
|
|
62
|
+
-keep class com.facebook.react.bridge.Promise { *; }
|
|
63
|
+
-keep class com.facebook.react.bridge.WritableMap { *; }
|
|
64
|
+
-keep class com.facebook.react.bridge.ReadableMap { *; }
|
|
65
|
+
|
|
66
|
+
# Optimization settings
|
|
67
|
+
-optimizationpasses 5
|
|
68
|
+
-dontusemixedcaseclassnames
|
|
69
|
+
-dontskipnonpubliclibraryclasses
|
|
70
|
+
-dontpreverify
|
|
71
|
+
-verbose
|
|
72
|
+
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
|
package/android/src/legacy/java/com/facebook/react/viewmanagers/GooglePayButtonManagerDelegate.java
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GeneratePropsJavaDelegate.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.facebook.react.viewmanagers;
|
|
11
|
+
|
|
12
|
+
import android.view.View;
|
|
13
|
+
import androidx.annotation.Nullable;
|
|
14
|
+
import com.facebook.react.uimanager.BaseViewManager;
|
|
15
|
+
import com.facebook.react.uimanager.BaseViewManagerDelegate;
|
|
16
|
+
import com.facebook.react.uimanager.LayoutShadowNode;
|
|
17
|
+
|
|
18
|
+
public class GooglePayButtonManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & GooglePayButtonManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
|
|
19
|
+
public GooglePayButtonManagerDelegate(U viewManager) {
|
|
20
|
+
super(viewManager);
|
|
21
|
+
}
|
|
22
|
+
@Override
|
|
23
|
+
public void setProperty(T view, String propName, @Nullable Object value) {
|
|
24
|
+
switch (propName) {
|
|
25
|
+
case "buttonType":
|
|
26
|
+
mViewManager.setButtonType(view, value == null ? null : (String) value);
|
|
27
|
+
break;
|
|
28
|
+
case "buttonStyle":
|
|
29
|
+
mViewManager.setButtonStyle(view, value == null ? null : (String) value);
|
|
30
|
+
break;
|
|
31
|
+
case "borderRadius":
|
|
32
|
+
mViewManager.setBorderRadius(view, value == null ? 0f : ((Double) value).doubleValue());
|
|
33
|
+
break;
|
|
34
|
+
case "allowedPaymentMethods":
|
|
35
|
+
mViewManager.setAllowedPaymentMethods(view, value == null ? null : (String) value);
|
|
36
|
+
break;
|
|
37
|
+
default:
|
|
38
|
+
super.setProperty(view, propName, value);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
package/android/src/legacy/java/com/facebook/react/viewmanagers/GooglePayButtonManagerInterface.java
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GeneratePropsJavaInterface.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.facebook.react.viewmanagers;
|
|
11
|
+
|
|
12
|
+
import android.view.View;
|
|
13
|
+
import androidx.annotation.Nullable;
|
|
14
|
+
|
|
15
|
+
public interface GooglePayButtonManagerInterface<T extends View> {
|
|
16
|
+
void setButtonType(T view, @Nullable String value);
|
|
17
|
+
void setButtonStyle(T view, @Nullable String value);
|
|
18
|
+
void setBorderRadius(T view, double value);
|
|
19
|
+
void setAllowedPaymentMethods(T view, @Nullable String value);
|
|
20
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GeneratePropsJavaDelegate.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.facebook.react.viewmanagers;
|
|
11
|
+
|
|
12
|
+
import android.view.View;
|
|
13
|
+
import androidx.annotation.Nullable;
|
|
14
|
+
import com.facebook.react.bridge.DynamicFromObject;
|
|
15
|
+
import com.facebook.react.uimanager.BaseViewManager;
|
|
16
|
+
import com.facebook.react.uimanager.BaseViewManagerDelegate;
|
|
17
|
+
import com.facebook.react.uimanager.LayoutShadowNode;
|
|
18
|
+
public class NativePaymentWidgetManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & NativePaymentWidgetManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
|
|
19
|
+
public NativePaymentWidgetManagerDelegate(U viewManager) {
|
|
20
|
+
super(viewManager);
|
|
21
|
+
}
|
|
22
|
+
@Override
|
|
23
|
+
public void setProperty(T view, String propName, @Nullable Object value) {
|
|
24
|
+
switch (propName) {
|
|
25
|
+
case "widgetType":
|
|
26
|
+
mViewManager.setWidgetType(view, value == null ? null : (String) value);
|
|
27
|
+
break;
|
|
28
|
+
case "sdkAuthorization":
|
|
29
|
+
mViewManager.setSdkAuthorization(view, value == null ? null : (String) value);
|
|
30
|
+
break;
|
|
31
|
+
case "options":
|
|
32
|
+
mViewManager.setOptions(view, new DynamicFromObject(value));
|
|
33
|
+
break;
|
|
34
|
+
default:
|
|
35
|
+
super.setProperty(view, propName, value);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GeneratePropsJavaInterface.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.facebook.react.viewmanagers;
|
|
11
|
+
|
|
12
|
+
import android.view.View;
|
|
13
|
+
import androidx.annotation.Nullable;
|
|
14
|
+
import com.facebook.react.bridge.Dynamic;
|
|
15
|
+
|
|
16
|
+
public interface NativePaymentWidgetManagerInterface<T extends View> {
|
|
17
|
+
void setWidgetType(T view, @Nullable String value);
|
|
18
|
+
|
|
19
|
+
void setOptions(T view, @Nullable Dynamic value);
|
|
20
|
+
void setSdkAuthorization(T view, @Nullable String value);
|
|
21
|
+
}
|
package/android/src/legacy/java/com/hyperswitchsdkreactnative/NativeHyperswitchSdkNativeSpec.java
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
* <p>
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJavaSpec.js
|
|
9
|
+
* @nolint
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
package com.hyperswitchsdkreactnative;
|
|
13
|
+
|
|
14
|
+
import com.facebook.proguard.annotations.DoNotStrip;
|
|
15
|
+
import com.facebook.react.bridge.Callback;
|
|
16
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
17
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
18
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
19
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
20
|
+
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
|
|
21
|
+
|
|
22
|
+
import javax.annotation.Nonnull;
|
|
23
|
+
|
|
24
|
+
public abstract class NativeHyperswitchSdkNativeSpec extends ReactContextBaseJavaModule implements TurboModule {
|
|
25
|
+
public static final String NAME = "HyperModule";
|
|
26
|
+
|
|
27
|
+
public NativeHyperswitchSdkNativeSpec(ReactApplicationContext reactContext) {
|
|
28
|
+
super(reactContext);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@Override
|
|
32
|
+
public @Nonnull String getName() {
|
|
33
|
+
return NAME;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@ReactMethod
|
|
37
|
+
@DoNotStrip
|
|
38
|
+
public abstract void sendMessageToNative(String message);
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@ReactMethod
|
|
42
|
+
@DoNotStrip
|
|
43
|
+
public abstract void startApplePay(String requestObj, Callback callback);
|
|
44
|
+
|
|
45
|
+
@ReactMethod
|
|
46
|
+
@DoNotStrip
|
|
47
|
+
public abstract void presentApplePay(String requestObj, Callback callback);
|
|
48
|
+
|
|
49
|
+
@ReactMethod
|
|
50
|
+
@DoNotStrip
|
|
51
|
+
public abstract void launchApplePay(String requestObj, Callback callback);
|
|
52
|
+
|
|
53
|
+
@ReactMethod
|
|
54
|
+
@DoNotStrip
|
|
55
|
+
public abstract void launchGPay(String requestObj, Callback callback);
|
|
56
|
+
|
|
57
|
+
@ReactMethod
|
|
58
|
+
@DoNotStrip
|
|
59
|
+
public abstract void exitPaymentsheet(double rootTag, String result, boolean reset);
|
|
60
|
+
|
|
61
|
+
@ReactMethod
|
|
62
|
+
@DoNotStrip
|
|
63
|
+
public abstract void exitPaymentMethodManagement(double rootTag, String result, boolean reset);
|
|
64
|
+
|
|
65
|
+
@ReactMethod
|
|
66
|
+
@DoNotStrip
|
|
67
|
+
public abstract void exitWidget(String result, String widgetType);
|
|
68
|
+
|
|
69
|
+
@ReactMethod
|
|
70
|
+
@DoNotStrip
|
|
71
|
+
public abstract void notifyWidgetPaymentResult(Integer rootTag, String result);
|
|
72
|
+
|
|
73
|
+
@ReactMethod
|
|
74
|
+
@DoNotStrip
|
|
75
|
+
public abstract void exitCardForm(String result);
|
|
76
|
+
|
|
77
|
+
@ReactMethod
|
|
78
|
+
@DoNotStrip
|
|
79
|
+
public abstract void exitWidgetPaymentsheet(double rootTag, String result, boolean reset);
|
|
80
|
+
|
|
81
|
+
@ReactMethod
|
|
82
|
+
@DoNotStrip
|
|
83
|
+
public abstract void launchWidgetPaymentSheet(String requestObj, Callback callback);
|
|
84
|
+
|
|
85
|
+
@ReactMethod
|
|
86
|
+
@DoNotStrip
|
|
87
|
+
public abstract void updateWidgetHeight(double height);
|
|
88
|
+
|
|
89
|
+
@ReactMethod
|
|
90
|
+
@DoNotStrip
|
|
91
|
+
public abstract void emitPaymentEvent(int rootTag, String eventType, ReadableMap payload);
|
|
92
|
+
|
|
93
|
+
@ReactMethod
|
|
94
|
+
@DoNotStrip
|
|
95
|
+
public abstract void onUpdateIntentEvent(Integer rootTag, String type, String result);
|
|
96
|
+
|
|
97
|
+
@ReactMethod
|
|
98
|
+
@DoNotStrip
|
|
99
|
+
public abstract void onAddPaymentMethod(String data);
|
|
100
|
+
|
|
101
|
+
@ReactMethod
|
|
102
|
+
public abstract void addListener(String eventName);
|
|
103
|
+
|
|
104
|
+
@ReactMethod
|
|
105
|
+
public abstract void removeListeners(Double count);
|
|
106
|
+
}
|