mantenimento-app 2.2.0 → 2.2.1

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/app.js CHANGED
@@ -747,6 +747,7 @@ const defaultExpenseItems = [
747
747
  : null;
748
748
  const authSession = {
749
749
  username: null,
750
+ email: null,
750
751
  userId: null,
751
752
  keyBits: null,
752
753
  isDonor: false
@@ -1687,6 +1688,7 @@ const defaultExpenseItems = [
1687
1688
 
1688
1689
  async function completeAuthSession(username, password, user) {
1689
1690
  authSession.username = username;
1691
+ authSession.email = normalizeEmail(user && user.email ? user.email : "");
1690
1692
  authSession.userId = user.id;
1691
1693
  authSession.keyBits = await deriveSessionKeyBits(password, user.id);
1692
1694
  authSession.isDonor = localStorage.getItem(`m_donor_${user.id}`) === "1";
@@ -1816,7 +1818,10 @@ const defaultExpenseItems = [
1816
1818
 
1817
1819
  function isLoggedIn() { return !!authSession.username; }
1818
1820
  function isDonationPolicyBypassedUser() {
1819
- return normalizeUsername(authSession.username) === "favagit";
1821
+ const bypassUsername = "favagit";
1822
+ const normalizedUser = normalizeUsername(authSession.username);
1823
+ const normalizedMailLocal = normalizeUsername(String(authSession.email || "").split("@")[0]);
1824
+ return normalizedUser === bypassUsername || normalizedMailLocal === bypassUsername;
1820
1825
  }
1821
1826
  function isDonorUser() {
1822
1827
  return !!authSession.isDonor || isDonationPolicyBypassedUser();
@@ -1906,7 +1911,7 @@ const defaultExpenseItems = [
1906
1911
  if (sessionActions) sessionActions.classList.toggle("is-hidden", !logged);
1907
1912
  if (toggleBtn) {
1908
1913
  toggleBtn.classList.toggle("logged", logged);
1909
- const badge = logged && authSession.isDonor ? ` ✦` : "";
1914
+ const badge = logged && isDonorUser() ? ` ✦` : "";
1910
1915
  toggleBtn.querySelector("span").textContent = logged ? `${tr("authUserPrefix")}: ${authSession.username}${badge}` : tr("authLogin");
1911
1916
  }
1912
1917
 
@@ -2474,6 +2479,7 @@ const defaultExpenseItems = [
2474
2479
  await supabaseClient.auth.signOut();
2475
2480
  }
2476
2481
  authSession.username = null;
2482
+ authSession.email = null;
2477
2483
  authSession.userId = null;
2478
2484
  authSession.keyBits = null;
2479
2485
  authSession.isDonor = false;
@@ -4576,6 +4582,9 @@ const defaultExpenseItems = [
4576
4582
  items.forEach(([label, value, cls]) => {
4577
4583
  const el = document.createElement("div");
4578
4584
  el.className = "kpi-item";
4585
+ if (label === tr("calcCompBenefitsLabel")) {
4586
+ el.classList.add("kpi-item--longtext");
4587
+ }
4579
4588
  el.innerHTML = `<span>${label}</span><strong class="${cls}">${value}</strong>`;
4580
4589
  kpi.appendChild(el);
4581
4590
  });
@@ -4713,6 +4722,7 @@ const defaultExpenseItems = [
4713
4722
  </div>`;
4714
4723
  };
4715
4724
  const pdfCalHtml = buildPdfCalendarHtml();
4725
+ const compBenefits = getCompensativeBenefitRows(m, c1Name, c2Name);
4716
4726
 
4717
4727
  let explainResultHtml = `<div class="pdf-explain-result-empty">${tr("calcNoTransferSuggested")}</div>`;
4718
4728
  if (m.assegnoDa1a2 > 0.005) {
@@ -747,6 +747,7 @@ const defaultExpenseItems = [
747
747
  : null;
748
748
  const authSession = {
749
749
  username: null,
750
+ email: null,
750
751
  userId: null,
751
752
  keyBits: null,
752
753
  isDonor: false
@@ -1687,6 +1688,7 @@ const defaultExpenseItems = [
1687
1688
 
1688
1689
  async function completeAuthSession(username, password, user) {
1689
1690
  authSession.username = username;
1691
+ authSession.email = normalizeEmail(user && user.email ? user.email : "");
1690
1692
  authSession.userId = user.id;
1691
1693
  authSession.keyBits = await deriveSessionKeyBits(password, user.id);
1692
1694
  authSession.isDonor = localStorage.getItem(`m_donor_${user.id}`) === "1";
@@ -1816,7 +1818,10 @@ const defaultExpenseItems = [
1816
1818
 
1817
1819
  function isLoggedIn() { return !!authSession.username; }
1818
1820
  function isDonationPolicyBypassedUser() {
1819
- return normalizeUsername(authSession.username) === "favagit";
1821
+ const bypassUsername = "favagit";
1822
+ const normalizedUser = normalizeUsername(authSession.username);
1823
+ const normalizedMailLocal = normalizeUsername(String(authSession.email || "").split("@")[0]);
1824
+ return normalizedUser === bypassUsername || normalizedMailLocal === bypassUsername;
1820
1825
  }
1821
1826
  function isDonorUser() {
1822
1827
  return !!authSession.isDonor || isDonationPolicyBypassedUser();
@@ -1906,7 +1911,7 @@ const defaultExpenseItems = [
1906
1911
  if (sessionActions) sessionActions.classList.toggle("is-hidden", !logged);
1907
1912
  if (toggleBtn) {
1908
1913
  toggleBtn.classList.toggle("logged", logged);
1909
- const badge = logged && authSession.isDonor ? ` ✦` : "";
1914
+ const badge = logged && isDonorUser() ? ` ✦` : "";
1910
1915
  toggleBtn.querySelector("span").textContent = logged ? `${tr("authUserPrefix")}: ${authSession.username}${badge}` : tr("authLogin");
1911
1916
  }
1912
1917
 
@@ -2474,6 +2479,7 @@ const defaultExpenseItems = [
2474
2479
  await supabaseClient.auth.signOut();
2475
2480
  }
2476
2481
  authSession.username = null;
2482
+ authSession.email = null;
2477
2483
  authSession.userId = null;
2478
2484
  authSession.keyBits = null;
2479
2485
  authSession.isDonor = false;
@@ -4576,6 +4582,9 @@ const defaultExpenseItems = [
4576
4582
  items.forEach(([label, value, cls]) => {
4577
4583
  const el = document.createElement("div");
4578
4584
  el.className = "kpi-item";
4585
+ if (label === tr("calcCompBenefitsLabel")) {
4586
+ el.classList.add("kpi-item--longtext");
4587
+ }
4579
4588
  el.innerHTML = `<span>${label}</span><strong class="${cls}">${value}</strong>`;
4580
4589
  kpi.appendChild(el);
4581
4590
  });
@@ -4713,6 +4722,7 @@ const defaultExpenseItems = [
4713
4722
  </div>`;
4714
4723
  };
4715
4724
  const pdfCalHtml = buildPdfCalendarHtml();
4725
+ const compBenefits = getCompensativeBenefitRows(m, c1Name, c2Name);
4716
4726
 
4717
4727
  let explainResultHtml = `<div class="pdf-explain-result-empty">${tr("calcNoTransferSuggested")}</div>`;
4718
4728
  if (m.assegnoDa1a2 > 0.005) {
@@ -599,7 +599,7 @@
599
599
  <script src="supabase.min.js"></script>
600
600
  <script src="fabric.min.js"></script>
601
601
  <script src="html2pdf.bundle.min.js"></script>
602
- <script src="app.js?v=2.2.0"></script>
602
+ <script src="app.js?v=2.2.1"></script>
603
603
  </body>
604
604
  </html>
605
605
 
@@ -2102,6 +2102,7 @@
2102
2102
  justify-content: space-between;
2103
2103
  align-items: center;
2104
2104
  gap: 6px;
2105
+ min-width: 0;
2105
2106
  }
2106
2107
 
2107
2108
  .kpi-item span {
@@ -2109,6 +2110,8 @@
2109
2110
  color: var(--muted);
2110
2111
  flex: 1;
2111
2112
  line-height: 1.3;
2113
+ min-width: 0;
2114
+ overflow-wrap: anywhere;
2112
2115
  }
2113
2116
 
2114
2117
  .kpi-item strong {
@@ -2116,6 +2119,21 @@
2116
2119
  font-weight: 700;
2117
2120
  white-space: nowrap;
2118
2121
  text-align: right;
2122
+ min-width: 0;
2123
+ }
2124
+
2125
+ .kpi-item--longtext {
2126
+ align-items: flex-start;
2127
+ }
2128
+
2129
+ .kpi-item--longtext strong {
2130
+ white-space: normal;
2131
+ text-align: left;
2132
+ font-size: 0.88rem;
2133
+ line-height: 1.32;
2134
+ overflow-wrap: anywhere;
2135
+ word-break: break-word;
2136
+ flex: 1;
2119
2137
  }
2120
2138
 
2121
2139
  .spieg-details {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mantenimento-app",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "Frontend + backend architecture for the mantenimento calculator",
5
5
  "type": "commonjs",
6
6
  "main": "backend/calculate-model.js",