@meetelise/chat 1.20.11 → 1.20.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/public/dist/index.js +48 -48
- package/src/WebComponent/me-chat.ts +13 -1
|
@@ -16,6 +16,10 @@ import { installLauncher } from "./Launcher";
|
|
|
16
16
|
import "./MEChat.css";
|
|
17
17
|
import { getRawAvailabilities } from "../getAvailabilities";
|
|
18
18
|
import { StyleInfo } from "lit/directives/style-map";
|
|
19
|
+
import addMinutes from "date-fns/addMinutes";
|
|
20
|
+
import formatISO from "date-fns/formatISO";
|
|
21
|
+
import parseISO from "date-fns/parseISO";
|
|
22
|
+
import isPast from "date-fns/isPast";
|
|
19
23
|
|
|
20
24
|
export interface Options {
|
|
21
25
|
building: string;
|
|
@@ -221,10 +225,18 @@ export class MEChat extends LitElement {
|
|
|
221
225
|
}
|
|
222
226
|
(talkjsPopupElement as HTMLElement).style.zIndex = "99999999999";
|
|
223
227
|
this.popup = popup;
|
|
224
|
-
|
|
228
|
+
const autoOpenedTimestamp = sessionStorage.getItem("autoOpenedTimestamp");
|
|
229
|
+
const shouldAutoOpen =
|
|
230
|
+
!autoOpenedTimestamp ||
|
|
231
|
+
(autoOpenedTimestamp && isPast(parseISO(autoOpenedTimestamp)));
|
|
232
|
+
if (building.autoOpenChatWidget && shouldAutoOpen) {
|
|
225
233
|
this.popup.show();
|
|
226
234
|
this.hideLauncher = true;
|
|
227
235
|
this.hasMounted = true;
|
|
236
|
+
sessionStorage.setItem(
|
|
237
|
+
"autoOpenedTimestamp",
|
|
238
|
+
formatISO(addMinutes(new Date(), 15))
|
|
239
|
+
);
|
|
228
240
|
}
|
|
229
241
|
};
|
|
230
242
|
|