import type { TurboModule } from "react-native/Libraries/TurboModule/RCTExport"; import { TurboModuleRegistry } from 'react-native'; export interface Spec extends TurboModule { /** * Initialize Paygilant SDK with all possible combinations of parameters. * @param serverUrl Server URL used to identify the app environment at the Paygilant Cloud environment. * This ID will be provided by Paygilant during the integration process. * @param clientSessionId (Optional) A unique session ID managed by the client. Use this only if handling sessions manually. * @param toAskPermissions (Optional) Whether to ask for all Paygilant list permissions immediately upon initialization. * @return Promise that resolves to a boolean indicating initialization success. */ initialize(serverUrl: string, clientSessionId?: string, toAskPermissions?: boolean): Promise; /** * get session id from paygilant * @return SessionId */ getSessionId(): Promise; // Internal method to set the React Native version setReactNativeVersion(version: string): Promise; /** * get approve policy status from paygilant * @return isApprovePolicy */ isApprovePolicy():Promise; /** * After the initialize and approve policy process. * the app needs to update the SDK with this information. * @param approvePolicy */ setApprovePolicy(approvePolicy: boolean): Promise; getDeviceId(): Promise; startNewScreenListener(type: string, screenId: number): Promise logout():Promise; /** * Initiates the permission request process for both Android and iOS after confirming * that the user has approved the necessary policies. * * This method handles the permission request dynamically based on the platform and * the OS version. It ensures that all necessary runtime permissions are requested * according to the user's consent and app requirements. * * ## Android Specifics: * - Initializes a list of essential permissions including phone state, contacts access, * fine and coarse location, and camera usage. * - For Android Marshmallow (API level 23) to Android R (API level 30), it adds * permissions to read and write to external storage. * - From Android S (API level 31) and above, permissions for Bluetooth connectivity * and scanning are added, in line with the new permission model introduced in Android 12. * - For Android Tiramisu (API level 33) and above, permissions to access media images * and videos are added, aligning with the new privacy changes where reading media files * requires explicit permissions. * * ## iOS Specifics: * - Requests permissions for photo library access, contact access, camera usage, location services, * and tracking based on the user's consent and `Info.plist` configurations. * - Requires the user's agreement to the app's privacy policy or terms of service. * - Necessary usage descriptions must be declared in `Info.plist` with keys such as * `NSPhotoLibraryUsageDescription`, `NSContactsUsageDescription`, `NSCameraUsageDescription`, * `NSLocationWhenInUseUsageDescription`, and `NSUserTrackingUsageDescription`. * * - Precondition: * - User must have agreed to the application's privacy policy. * - Appropriate keys in `Info.plist` for iOS and runtime permissions for Android. * * - Postcondition: * - Permissions are requested from the user as needed. * - The `toAskPermissions` flag is reset, indicating completion of the permission flow. * * - Usage: * This method should be invoked when it's appropriate to ask the user for permissions, * typically after they have agreed to your privacy policies or when they are about to * use functionality requiring these permissions. Ideal scenarios include after successful * login or during the onboarding process. * * - Example: * ```javascript * if (userConsentsToPrivacyPolicy) { * Paygilant.askPaygilantPermissions(); * } */ askPaygilantPermissions():Promise; /** * Kicks off the Paygilant face‑verification flow. * @param userId Unique non‑empty user identifier. * @returns Promise resolving to "true" or "false". * Rejects with code 'verification_error' and message: * - "setApprovePolicy method to true" * - "userId is null or empty" * - "Error connecting to server" */ startUserVerification(userId: string): Promise; /** * Passes a clientSessionId into the SDK and returns whatever the SDK hands back. * @param clientSessionId * @return Promise – resolves to the sessionId, or "no_session_id" if none. * Rejects with code 'error' and the exception message. */ setClientSessionId(clientSessionId: string): Promise; } export default TurboModuleRegistry.getEnforcing('PaygilantWrapper');