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 f19f3e4 commit cceeafd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
5 changes: 5 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,11 @@
noTokensFoundEvent: 'No Tokens Found',
balancesFoundEvent: 'Balance Found',
nftsFoundEvent: 'Token(s) Found',
reDirectIssuerHeadingEvent: 'Connecting to Issuers...',
reDirectIssuerBodyEvent: "Your browser will re-direct shortly",
authenticationHeadingEvent: 'Authenticating...',
authenticationBodyEvent: "You may need to sign a new challenge in your wallet",
cancelAction: "Cancel",
openingAction: "Let's Go!",
theme: theme,
position: "top-right",
Expand Down
26 changes: 16 additions & 10 deletions src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -749,9 +749,11 @@ export class Client {
private async loadRemoteOutletTokens(issuer: OffChainTokenConfig): Promise<OutletTokenResult | void> {
this.tokenStore.setTokens(issuer.collectionID, [])
this.ui.showLoader(
'<h4>Connecting to issuers...</h4>',
'<small>Your browser will re-direct shortly</small>',
"<button class='cancel-autoload-btn btn-tn' aria-label='Cancel authentication'>Cancel</button>",
`<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'
}</button>`,
)
this.enableTokenAutoLoadCancel()
if (this.config.uiOptions?.userCancelIssuerAutoRedirectTimer) await sleep(this.config.uiOptions.userCancelIssuerAutoRedirectTimer)
Expand Down Expand Up @@ -850,9 +852,11 @@ export class Client {
if (this.ui) {
this.ui.showLoaderDelayed(
[
'<h4>Authenticating...</h4>',
'<small>You may need to sign a new challenge in your wallet</small>',
"<button class='cancel-auth-btn btn-tn' aria-label='Cancel authentication'>Cancel</button>",
`<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'
}</button>`,
],
600,
true,
Expand Down Expand Up @@ -881,7 +885,7 @@ export class Client {
if (err.message === 'WALLET_REQUIRED') {
return this.handleWalletRequired(authRequest)
}
// errorHandler(err, 'error', () => this.handleProofError(err, `multi issuer authentication via ${tokenOrigin}`), null, false, true)
// errorHandler(err, 'error', () => this.handleProofError(err, `multi issuer authentication via ${ tokenOrigin }`), null, false, true)
console.error(err)
throw err
}
Expand Down Expand Up @@ -923,9 +927,11 @@ export class Client {
if (this.ui) {
this.ui.showLoaderDelayed(
[
'<h4>Authenticating...</h4>',
'<small>You may need to sign a new challenge in your wallet</small>',
"<button class='cancel-auth-btn btn-tn' aria-label='Cancel authentication'>Cancel</button>",
`<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'
}</button>`,
],
600,
true,
Expand Down
5 changes: 5 additions & 0 deletions src/client/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ export interface UIOptionsInterface {
openingAction?: string
issuerHeading?: string
repeatAction?: string
cancelAction?: string
authenticationHeadingEvent?: string
authenticationBodyEvent?: string
reDirectIssuerEventHeading?: string
reDirectIssuerBodyEvent?: string
theme?: UItheme
position?: PopupPosition
autoPopup?: boolean
Expand Down

0 comments on commit cceeafd

Please sign in to comment.