Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/components/ezp-auth/ezp-auth.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Host, h, Prop, State, Event, EventEmitter, Listen } from '@stencil/core'
import { Component, Host, h, Prop, State, Event, EventEmitter, Listen, Watch } from '@stencil/core'
import { EzpAuthorizationService } from '../../services/auth'
import authStore from '../../services/auth'
import i18next from 'i18next'
Expand All @@ -13,6 +13,7 @@ export class EzpAuth {
@Prop() hidelogin: boolean
@Prop() trigger: string
@Prop() code: string
@Prop() webview: boolean = false

@State() auth: EzpAuthorizationService
@State() authURI: string
Expand All @@ -37,6 +38,17 @@ export class EzpAuth {
this.authCancel.emit()
}

@Watch('code')
async watchCode(newCode: string) {
if (newCode && newCode.length > 0) {
authStore.state.code = newCode
this.auth.getAccessToken().then(() => {
this.authCancel.emit()
this.authSuccess.emit()
})
}
}

oauthPopupWindow: Window = null
previousUrl = null

Expand All @@ -47,6 +59,12 @@ export class EzpAuth {
return
}

// WebView mode: redirect current window instead of opening popup
if (this.webview) {
window.location.href = url
return
}

// remove any existing event listeners
window.removeEventListener('message', this.receiveMessage)

Expand Down
2 changes: 2 additions & 0 deletions src/components/ezp-printing/ezp-printing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export class EzpPrinting {
@Prop() code: string
@Prop() filedata: string
@Prop() seamless: boolean = false
@Prop() webview: boolean = false

/**
*
Expand Down Expand Up @@ -365,6 +366,7 @@ export class EzpPrinting {
hidelogin={this.hidelogin}
trigger={this.trigger}
code={this.code}
webview={this.webview}
></ezp-auth>
) : this.printOpen ? (
<ezp-printer-selection
Expand Down