Skip to content

Commit

Permalink
added more text config options
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Taras authored and Nick Taras committed Sep 27, 2023
1 parent cceeafd commit bad56d5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/client/auth/signedUNChallenge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class SignedUNChallenge extends AbstractAuthentication implements Authent
}
}

if (!currentProof){
if (!currentProof) {
let walletConnection = connection.provider

currentProof = {
Expand Down
20 changes: 10 additions & 10 deletions src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -749,14 +749,14 @@ export class Client {
private async loadRemoteOutletTokens(issuer: OffChainTokenConfig): Promise<OutletTokenResult | void> {
this.tokenStore.setTokens(issuer.collectionID, [])
this.ui.showLoader(
`<h4>${this.config.uiOptions.reDirectIssuerEventHeading ?? 'Connecting to Issuers...'}</h4>`,
`<small>${this.config.uiOptions.reDirectIssuerBodyEvent ?? 'Your browser will re-direct shortly'}</small>`,
`<h4>${this.config.uiOptions?.reDirectIssuerEventHeading ?? 'Connecting to Issuers...'}</h4>`,
`<small>${this.config.uiOptions?.reDirectIssuerBodyEvent ?? 'Your browser will re-direct shortly'}</small>`,
`<button class='cancel-autoload-btn btn-tn' aria-label='Cancel page re-direct'>${
this.config.uiOptions.cancelAction ?? 'Cancel'
this.config.uiOptions?.cancelAction ?? 'Cancel'
}</button>`,
)
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 {}
}
Expand Down Expand Up @@ -852,10 +852,10 @@ export class Client {
if (this.ui) {
this.ui.showLoaderDelayed(
[
`<h4>${this.config.uiOptions.authenticationHeadingEvent ?? 'Authenticating...'}</h4>`,
`<small>${this.config.uiOptions.authenticationBodyEvent ?? 'You may need to sign a new challenge in your wallet'}</small>`,
`<h4>${this.config.uiOptions?.authenticationHeadingEvent ?? 'Authenticating...'}</h4>`,
`<small>${this.config.uiOptions?.authenticationBodyEvent ?? 'You may need to sign a new challenge in your wallet'}</small>`,
`<button class='cancel-auth-btn btn-tn' aria-label='Cancel authentication'>${
this.config.uiOptions.cancelAction ?? 'Cancel'
this.config.uiOptions?.cancelAction ?? 'Cancel'
}</button>`,
],
600,
Expand Down Expand Up @@ -927,10 +927,10 @@ export class Client {
if (this.ui) {
this.ui.showLoaderDelayed(
[
`<h4>${this.config.uiOptions.authenticationHeadingEvent ?? 'Authenticating...'}</h4>`,
`<small>${this.config.uiOptions.authenticationBodyEvent ?? 'You may need to sign a new challenge in your wallet'}</small>`,
`<h4>${this.config.uiOptions?.authenticationHeadingEvent ?? 'Authenticating...'}</h4>`,
`<small>${this.config.uiOptions?.authenticationBodyEvent ?? 'You may need to sign a new challenge in your wallet'}</small>`,
`<button class='cancel-auth-btn btn-tn' aria-label='Cancel authentication'>${
this.config.uiOptions.cancelAction ?? 'Cancel'
this.config.uiOptions?.cancelAction ?? 'Cancel'
}</button>`,
],
600,
Expand Down
2 changes: 2 additions & 0 deletions src/client/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/Web3WalletProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit bad56d5

Please sign in to comment.