99 InitSessionResponse ,
1010 ClaimCreationType ,
1111 ModalOptions ,
12+ ReclaimFlowLaunchOptions ,
1213} from './utils/types'
1314import { SessionStatus , DeviceType } from './utils/types'
1415import { ethers } from 'ethers'
@@ -39,7 +40,6 @@ import { assertValidSignedClaim, createLinkWithTemplateData, getWitnessesForClai
3940import { QRCodeModal } from './utils/modalUtils'
4041import loggerModule from './utils/logger' ;
4142import { getDeviceType , getMobileDeviceType , isMobileDevice } from './utils/device'
42- import { Features } from './utils/apis/feature'
4343import { canonicalStringify } from './utils/strings'
4444const logger = loggerModule . logger
4545
@@ -196,7 +196,6 @@ export class ReclaimProofRequest {
196196 private modalOptions ?: ModalOptions ;
197197 private modal ?: QRCodeModal ;
198198 private readonly FAILURE_TIMEOUT = 30 * 1000 ; // 30 seconds timeout, can be adjusted
199- private isNewLinkingEnabledAsync : Promise < boolean >
200199
201200 private constructor ( applicationId : string , providerId : string , options ?: ProofRequestOptions ) {
202201 this . providerId = providerId ;
@@ -243,12 +242,6 @@ export class ReclaimProofRequest {
243242 // Fetch sdk version from package.json
244243 this . sdkVersion = 'js-' + sdkVersion ;
245244 logger . info ( `Initializing client with applicationId: ${ this . applicationId } ` ) ;
246-
247- this . isNewLinkingEnabledAsync = Features . isNewLinkingEnabled ( {
248- applicationId : applicationId ,
249- providerId : providerId ,
250- sessionId : this . sessionId ,
251- } ) ;
252245 }
253246
254247 /**
@@ -839,6 +832,7 @@ export class ReclaimProofRequest {
839832 * - Mobile Android: Returns Instant App URL (if useAppClip is enabled)
840833 * - Desktop/Other: Returns standard verification URL
841834 *
835+ * @param launchOptions - Optional launch configuration to override default behavior
842836 * @returns Promise<string> - The generated request URL
843837 * @throws {SignatureNotFoundError } When signature is not set
844838 *
@@ -848,7 +842,9 @@ export class ReclaimProofRequest {
848842 * // Share this URL with users or display as QR code
849843 * ```
850844 */
851- async getRequestUrl ( ) : Promise < string > {
845+ async getRequestUrl ( launchOptions ?: ReclaimFlowLaunchOptions ) : Promise < string > {
846+ const options = launchOptions || this . options ?. launchOptions || { } ;
847+
852848 logger . info ( 'Creating Request Url' )
853849 if ( ! this . signature ) {
854850 throw new SignatureNotFoundError ( 'Signature is not set.' )
@@ -867,7 +863,9 @@ export class ReclaimProofRequest {
867863 const isIos = getMobileDeviceType ( ) === DeviceType . IOS ;
868864 if ( ! isIos ) {
869865 let instantAppUrl = this . buildSharePageUrl ( template ) ;
870- if ( await this . isNewLinkingEnabledAsync ) {
866+ const isDeferredDeeplinksFlowEnabled = options . canUseDeferredDeepLinksFlow ?? false ;
867+
868+ if ( isDeferredDeeplinksFlowEnabled ) {
871869 instantAppUrl = instantAppUrl . replace ( "/verifier" , "/link" ) ;
872870 }
873871 logger . info ( 'Instant App Url created successfully: ' + instantAppUrl ) ;
@@ -897,6 +895,7 @@ export class ReclaimProofRequest {
897895 * - Mobile Android: Redirects to Instant App
898896 * - Mobile iOS: Redirects to App Clip
899897 *
898+ * @param launchOptions - Optional launch configuration to override default behavior
900899 * @returns Promise<void>
901900 * @throws {SignatureNotFoundError } When signature is not set
902901 *
@@ -906,7 +905,9 @@ export class ReclaimProofRequest {
906905 * // The appropriate verification method will be triggered automatically
907906 * ```
908907 */
909- async triggerReclaimFlow ( ) : Promise < void > {
908+ async triggerReclaimFlow ( launchOptions ?: ReclaimFlowLaunchOptions ) : Promise < void > {
909+ const options = launchOptions || this . options ?. launchOptions || { } ;
910+
910911 if ( ! this . signature ) {
911912 throw new SignatureNotFoundError ( 'Signature is not set.' )
912913 }
@@ -941,7 +942,7 @@ export class ReclaimProofRequest {
941942 if ( mobileDeviceType === DeviceType . ANDROID ) {
942943 // Redirect to instant app URL
943944 logger . info ( 'Redirecting to Android instant app' ) ;
944- await this . redirectToInstantApp ( ) ;
945+ await this . redirectToInstantApp ( options ) ;
945946 } else if ( mobileDeviceType === DeviceType . IOS ) {
946947 // Redirect to app clip URL
947948 logger . info ( 'Redirecting to iOS app clip' ) ;
@@ -1027,7 +1028,7 @@ export class ReclaimProofRequest {
10271028 }
10281029 }
10291030
1030- private async redirectToInstantApp ( ) : Promise < void > {
1031+ private async redirectToInstantApp ( options : ReclaimFlowLaunchOptions ) : Promise < void > {
10311032 try {
10321033 let template = encodeURIComponent ( JSON . stringify ( this . templateData ) ) ;
10331034 template = replaceAll ( template , '(' , '%28' ) ;
@@ -1036,7 +1037,9 @@ export class ReclaimProofRequest {
10361037 let instantAppUrl = this . buildSharePageUrl ( template ) ;
10371038 logger . info ( 'Redirecting to Android instant app: ' + instantAppUrl ) ;
10381039
1039- if ( await this . isNewLinkingEnabledAsync ) {
1040+ const isDeferredDeeplinksFlowEnabled = options . canUseDeferredDeepLinksFlow ?? false ;
1041+
1042+ if ( isDeferredDeeplinksFlowEnabled ) {
10401043 instantAppUrl = instantAppUrl . replace ( "/verifier" , "/link" ) ;
10411044
10421045 // Construct Android intent deep link
@@ -1123,11 +1126,10 @@ export class ReclaimProofRequest {
11231126 // Redirect to app clip
11241127 window . location . href = appClipUrl ;
11251128
1126- if ( Features . isFirstAttemptToLaunchAppClip ( ) ) {
1127- setTimeout ( ( ) => {
1128- window . location . href = appClipUrl ;
1129- } , 2000 ) ;
1130- }
1129+ setTimeout ( ( ) => {
1130+ window . location . href = appClipUrl ;
1131+ // 5 second delay to allow app clip to launch
1132+ } , 5 * 1000 ) ;
11311133 } catch ( error ) {
11321134 logger . info ( 'Error redirecting to app clip:' , error ) ;
11331135 throw error ;
0 commit comments