PageSourceSearch

https://www.sompio.fi/wp-content/themes/hilla-theme/assets/js/tulo-notifications.js?version=1.1

js sompio.fi collected 2026-09-25 01:15:35 UTC 2,400 bytes, 82 lines download raw bytes

1function checkForTuloNotifications() {
2  var sessionToken = document.cookie
3    .split("; ")
4    .find((row) => row.startsWith("hda_nwt_sess"))
5    ?.split("=")[1];
6
7  if (!sessionToken) return;
8
9  var notifications = sessionStorage.getItem("tuloNotifications");
10  if (notifications) notifications = JSON.parse(notifications);
11  
12  var iat = notifications?.iat;
13  var now = Date.now();
14  var cacheTtl = 60000 * 5; // 5 minutes
15
16  if (notifications && now - iat < cacheTtl) {
17    renderTuloNotifications(notifications.items);
18  } else {
19    var env =
20      window.location.hostname.indexOf(".stage") > -1 ||
21      window.location.hostname.indexOf(".local") > -1
22        ? "stage"
23        : "prod";
24
25    var url =
26      env === "stage"
27        ? "https://hilla-data-api-staging.hillagroup.fi/api/v1/TuloPayway/notifications"
28        : "https://hilla-data-api.hillagroup.fi/api/v1/TuloPayway/notifications";
29
30    fetch(url, {
31      method: "GET",
32      headers: {
33        "Content-Type": "application/json",
34        hda_nwt_sess: `${sessionToken}`,
35      },
36    })
37      .then((response) => response.json())
38      .then((data) => {
39        sessionStorage.setItem("tuloNotifications", JSON.stringify({
40          iat: now,
41          items: data,
42        }));
43
44        renderTuloNotifications(data);
45      });
46  }
47}
48
49function renderTuloNotifications(items) {
50  var typeDescriptionMapping = {
51    expiring_creditcard_notification: "Päivitä maksukorttisi tiedot",
52  };
53
54  if (items.length > 0) {
55    var elements = document.querySelectorAll("[tulo-notification]");
56    elements.forEach((element) => {
57      element.setAttribute("tulo-notification", "true");
58    });
59
60    var tickerContainer = document.getElementById(
61      "tulo-notification-ticker-container"
62    );
63
64    if (tickerContainer) {
65      for (var item of items) {
66        var description = typeDescriptionMapping[item.type];
67        if (description) description = `: ${description}`;
68        var tickerHtml = `
69                    <div class="ticker ticker--tulo-notification">
70                        <a href="#" onclick="nav_myaccount();return false;">
71                            TILISI VAATII HUOMIOTA${description}
72                        </a>
73                    </div>`;
74        tickerContainer.innerHTML = tickerContainer.innerHTML + tickerHtml;
75      }
76    }
77  }
78}
79
80$(document).ready(function () {
81  checkForTuloNotifications();
82});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.