From bad56d58335d40273f92aca9659a9f07950e3df2 Mon Sep 17 00:00:00 2001 From: Nick Taras Date: Wed, 27 Sep 2023 21:25:03 +1000 Subject: [PATCH] added more text config options --- index.html | 1 + src/client/auth/signedUNChallenge.ts | 2 +- src/client/index.ts | 20 ++++++++++---------- src/client/ui.ts | 2 ++ src/wallet/Web3WalletProvider.ts | 2 +- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/index.html b/index.html index b2e7d118..c435f7ae 100644 --- a/index.html +++ b/index.html @@ -312,6 +312,7 @@ reDirectIssuerBodyEvent: "Your browser will re-direct shortly", authenticationHeadingEvent: 'Authenticating...', authenticationBodyEvent: "You may need to sign a new challenge in your wallet", + walletDidntConnectAction: "Wallet didn't connect", cancelAction: "Cancel", openingAction: "Let's Go!", theme: theme, diff --git a/src/client/auth/signedUNChallenge.ts b/src/client/auth/signedUNChallenge.ts index 37cc4195..0e476ce7 100644 --- a/src/client/auth/signedUNChallenge.ts +++ b/src/client/auth/signedUNChallenge.ts @@ -34,7 +34,7 @@ export class SignedUNChallenge extends AbstractAuthentication implements Authent } } - if (!currentProof){ + if (!currentProof) { let walletConnection = connection.provider currentProof = { diff --git a/src/client/index.ts b/src/client/index.ts index 4b55e90d..9d8d532e 100644 --- a/src/client/index.ts +++ b/src/client/index.ts @@ -749,14 +749,14 @@ export class Client { private async loadRemoteOutletTokens(issuer: OffChainTokenConfig): Promise { this.tokenStore.setTokens(issuer.collectionID, []) this.ui.showLoader( - `

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

`, - `${this.config.uiOptions.reDirectIssuerBodyEvent ?? 'Your browser will re-direct shortly'}`, + `

${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.config.uiOptions?.userCancelIssuerAutoRedirectTimer) await sleep(this.config.uiOptions?.userCancelIssuerAutoRedirectTimer) if (this.userCancelTokenAutoload) { return {} } @@ -852,10 +852,10 @@ export class Client { if (this.ui) { this.ui.showLoaderDelayed( [ - `

${this.config.uiOptions.authenticationHeadingEvent ?? 'Authenticating...'}

`, - `${this.config.uiOptions.authenticationBodyEvent ?? 'You may need to sign a new challenge in your wallet'}`, + `

${this.config.uiOptions?.authenticationHeadingEvent ?? 'Authenticating...'}

`, + `${this.config.uiOptions?.authenticationBodyEvent ?? 'You may need to sign a new challenge in your wallet'}`, ``, ], 600, @@ -927,10 +927,10 @@ export class Client { if (this.ui) { this.ui.showLoaderDelayed( [ - `

${this.config.uiOptions.authenticationHeadingEvent ?? 'Authenticating...'}

`, - `${this.config.uiOptions.authenticationBodyEvent ?? 'You may need to sign a new challenge in your wallet'}`, + `

${this.config.uiOptions?.authenticationHeadingEvent ?? 'Authenticating...'}

`, + `${this.config.uiOptions?.authenticationBodyEvent ?? 'You may need to sign a new challenge in your wallet'}`, ``, ], 600, diff --git a/src/client/ui.ts b/src/client/ui.ts index 16b970e3..cce414e5 100644 --- a/src/client/ui.ts +++ b/src/client/ui.ts @@ -26,10 +26,12 @@ export interface UIOptionsInterface { issuerHeading?: string repeatAction?: string cancelAction?: string + walletDidntConnectAction?: string authenticationHeadingEvent?: string authenticationBodyEvent?: string reDirectIssuerEventHeading?: string reDirectIssuerBodyEvent?: string + theme?: UItheme position?: PopupPosition autoPopup?: boolean diff --git a/src/wallet/Web3WalletProvider.ts b/src/wallet/Web3WalletProvider.ts index dbabf81f..e56dc4ef 100644 --- a/src/wallet/Web3WalletProvider.ts +++ b/src/wallet/Web3WalletProvider.ts @@ -161,7 +161,7 @@ export class Web3WalletProvider { // @ts-ignore let address = await this[walletType as keyof Web3WalletProvider](checkConnectionOnly) - if (!address) throw new Error("Wallet didn't connect") + if (!address) throw new Error(this.client.config.uiOptions?.walletDidntConnectAction ?? "Wallet didn't connect") this.saveConnections() this.emitSavedConnection(address)