@digital-realty/ix-app-logic
Advanced tools
Comparing version 1.0.1 to 1.0.2-alpha.0
@@ -10,3 +10,2 @@ import { ReactiveController, ReactiveControllerHost } from 'lit'; | ||
constructor(host: ReactiveControllerHost, checkFn: () => Promise<boolean>, checkIsTrueFn: Function, checkIsFalseFn: Function, checkIntervalMs?: number); | ||
hostConnected(): void; | ||
setInterval(): void; | ||
@@ -13,0 +12,0 @@ clearInterval(): void; |
@@ -9,5 +9,2 @@ export class TimeoutController { | ||
} | ||
hostConnected() { | ||
this.setInterval(); | ||
} | ||
setInterval() { | ||
@@ -14,0 +11,0 @@ this._interval = window.setInterval(async () => { |
@@ -698,4 +698,4 @@ import { css } from "lit"; | ||
.w-\\[380px\\] { | ||
width: 380px; | ||
.w-\\[332px\\] { | ||
width: 332px; | ||
} | ||
@@ -792,2 +792,6 @@ | ||
.leading-6 { | ||
line-height: 1.5rem; | ||
} | ||
.leading-loose { | ||
@@ -805,2 +809,7 @@ line-height: 2; | ||
.text-slate-500 { | ||
--tw-text-opacity: 1; | ||
color: rgb(100 116 139 / var(--tw-text-opacity)); | ||
} | ||
.text-white { | ||
@@ -807,0 +816,0 @@ --tw-text-opacity: 1; |
@@ -6,7 +6,10 @@ import { LitElement } from 'lit'; | ||
timer: number; | ||
openedAt: number; | ||
externalCheck?: Function; | ||
private _timerInterval; | ||
private _tickingTimer; | ||
private timeoutController; | ||
onClosed(): void; | ||
private _handleOpened; | ||
private _handleClosed; | ||
render(): import("lit-html").TemplateResult<1>; | ||
} |
@@ -11,18 +11,36 @@ import { __decorate } from "tslib"; | ||
this.timer = 300000; | ||
this.openedAt = +new Date(); | ||
this._timerInterval = 1000; | ||
this._tickingTimer = 0; | ||
this.timeoutController = new TimeoutController(this, async () => this._tickingTimer >= this.timer, () => (window.location.href = '/logout?isIdle=true'), () => (this._tickingTimer += this._timerInterval), this._timerInterval); | ||
this.timeoutController = new TimeoutController(this, async () => this.openedAt === -1 || +new Date() - this.openedAt >= this.timer, () => (window.location.href = '/logout?isIdle=true'), () => { | ||
this._tickingTimer += this._timerInterval; | ||
if (this.externalCheck) { | ||
this.externalCheck(); | ||
} | ||
}, this._timerInterval); | ||
} | ||
onClosed() { | ||
_handleOpened() { | ||
this.timeoutController.setInterval(); | ||
} | ||
_handleClosed() { | ||
this._tickingTimer = 0; | ||
this.timeoutController.clearInterval(); | ||
this.dispatchEvent(new Event('closed')); | ||
} | ||
render() { | ||
const timeInSeconds = (this.timer - this._tickingTimer) / 1000; | ||
const now = +new Date(); | ||
const openedAt = this.openedAt > 0 ? this.openedAt : now; | ||
const timeInSeconds = (this.timer - Math.round((now - openedAt) / 1000) * 1000) / 1000; | ||
return html ` | ||
<ix-dialog ?open=${this.open} prevent-cancel @closed=${this.onClosed}> | ||
<ix-dialog | ||
?open=${this.open} | ||
prevent-cancel | ||
@closed=${this._handleClosed} | ||
@opened=${this._handleOpened} | ||
> | ||
<h1 slot="headline" class="dlr-text-heading">Log Out Warning</h1> | ||
<div slot="content"> | ||
<div class="w-[380px]"> | ||
<p> | ||
Due to inactivity, your session will expire in | ||
<div class="w-[332px]"> | ||
<p class="text-slate-500 leading-6"> | ||
Due to inactivity, your session will <br />expire in | ||
${this.timer / 60000} minutes. | ||
@@ -37,3 +55,5 @@ </p> | ||
<ix-button | ||
@click=${() => (window.location.href = '/logout')} | ||
@click=${() => { | ||
window.location.href = '/logout'; | ||
}} | ||
appearance="text" | ||
@@ -66,2 +86,5 @@ > | ||
__decorate([ | ||
property({ type: Number, attribute: 'opened-at' }) | ||
], IxAutoLogoutDialog.prototype, "openedAt", void 0); | ||
__decorate([ | ||
state() | ||
@@ -68,0 +91,0 @@ ], IxAutoLogoutDialog.prototype, "_tickingTimer", void 0); |
@@ -6,3 +6,3 @@ { | ||
"author": "ix-app-logic", | ||
"version": "1.0.1", | ||
"version": "1.0.2-alpha.0", | ||
"type": "module", | ||
@@ -36,6 +36,6 @@ "exports": { | ||
"@adobe/lit-mobx": "^2.2.2", | ||
"@digital-realty/ix-twlit": "1.0.1", | ||
"@digital-realty/ix-button": "^3.2.32", | ||
"@digital-realty/ix-dialog": "^1.0.30", | ||
"@digital-realty/ix-progress": "^1.2.3", | ||
"@digital-realty/ix-twlit": "^1.0.3", | ||
"@digital-realty/theme": "^2.1.3", | ||
@@ -42,0 +42,0 @@ "lit": "^3.1.4", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
147313
25
1058
2
+ Added@digital-realty/ix-twlit@1.0.1(transitive)
- Removed@digital-realty/ix-twlit@1.0.3(transitive)