diff --git a/index.html b/index.html index 79555196..b3a6d934 100644 --- a/index.html +++ b/index.html @@ -354,7 +354,13 @@ }); window.negotiator.on("tokens-selected", (tokens) => { - console.log("tokens-selected", tokens); + console.log("tokens-selected 1", tokens); + }); + window.negotiator.on("tokens-selected", (tokens) => { + console.log("tokens-selected 2", tokens); + }); + window.negotiator.on("tokens-selected", (tokens) => { + console.log("tokens-selected 3", tokens); }); window.negotiator.on("connected-wallet", (wallet) => { console.log("connected wallet", wallet); diff --git a/src/client/index.ts b/src/client/index.ts index ad53ad82..6f6b7e6d 100644 --- a/src/client/index.ts +++ b/src/client/index.ts @@ -521,6 +521,11 @@ export class Client { } this.eventSender('tokens-loaded', { loadedCollections: Object.keys(this.tokenStore.getCurrentIssuers()).length }) + + // use retry logic here too + // document.querySelectorAll('.connect-btn-tn .lds-ellipsis').forEach((el) => { + // el.parentElement.innerHTML = this.config.uiOptions?.loadAction ?? 'Load Collection' + // }) } public cancelTokenAutoload() { @@ -669,6 +674,11 @@ export class Client { this.eventSender('tokens-selected', { selectedTokens: tokens }) this.eventSender('tokens-loaded', { loadedCollections: Object.keys(tokens).length }) + // use retry logic here too + // document.querySelectorAll('.connect-btn-tn .lds-ellipsis').forEach((el) => { + // el.parentElement.innerHTML = this.config.uiOptions?.loadAction ?? 'Load Collection' + // }) + // Feature not supported when an end users third party cookies are disabled // because the use of a tab requires a user gesture. if (this.messaging.core.iframeStorageSupport === false && Object.keys(this.tokenStore.getCurrentTokens(false)).length === 0) @@ -758,18 +768,20 @@ export class Client { private async loadRemoteOutletTokens(issuer: OffChainTokenConfig): Promise { const redirectRequired = shouldUseRedirectMode(this.config.offChainRedirectMode) if (redirectRequired) this.tokenStore.setTokens(issuer.collectionID, []) - this.ui.showLoader( + this.ui?.showLoader( `

${this.config.uiOptions?.reDirectIssuerEventHeading ?? 'Connecting to Issuers...'}

`, `${this.config.uiOptions?.reDirectIssuerBodyEvent ?? 'Your browser will re-direct shortly'}`, ``, ) - this.enableTokenAutoLoadCancel() - if (this.config.uiOptions?.userCancelIssuerAutoRedirectTimer) await sleep(this.config.uiOptions.userCancelIssuerAutoRedirectTimer) - if (this.userCancelTokenAutoload) { - this.userCancelTokenAutoload = false - return {} + if (!issuer.onChain) { + this.enableTokenAutoLoadCancel() + await sleep(this.config.uiOptions.userCancelIssuerAutoRedirectTimer ?? 2500) + if (this.userCancelTokenAutoload) { + this.userCancelTokenAutoload = false + return {} + } } const res = await this.messaging.sendMessage( { diff --git a/src/client/views/select-issuers.ts b/src/client/views/select-issuers.ts index 6bea6680..671f7a92 100644 --- a/src/client/views/select-issuers.ts +++ b/src/client/views/select-issuers.ts @@ -110,7 +110,9 @@ export class SelectIssuers extends AbstractView { protected afterRender() { if (this.client.issuersLoaded) { - if (this.client.getTokenStore().hasUnloadedTokens()) this.autoLoadTokens() + if (this.client.getTokenStore().hasUnloadedTokens()) { + this.autoLoadTokens() + } } else { this.issuersLoading() }