@scalio-cloud/ui 0.100.0 → 0.100.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalio-cloud/ui",
3
- "version": "0.100.0",
3
+ "version": "0.100.1",
4
4
  "description": "Scalio Control Room design tokens, Tailwind preset, self-hosted fonts, the shared app header, sign-in layout, sidebar and page blocks",
5
5
  "license": "SEE LICENSE IN README.md",
6
6
  "private": false,
@@ -17,20 +17,35 @@ function cleanTenantKey(value) {
17
17
  return GUID.test(v) || DOMAIN.test(v) ? v : "";
18
18
  }
19
19
 
20
+ // Where a tenant row of an app keeps its Microsoft ids: on the row, or in the summary of its connection
21
+ // (Citadel `connection`, Pulse and Atrium `read`/`write`, all with `azure_tenant_id`).
22
+ const PARTS = ["connection", "read", "write"];
23
+ const ID_FIELDS = ["azure_tenant_id", "tenant_id", "ms_tenant_id"];
24
+ function candidates(t) {
25
+ const out = [];
26
+ const add = (v) => { if (typeof v === "string" && v) out.push(v); };
27
+ add(t.domain);
28
+ PARTS.forEach((p) => { if (t[p] && typeof t[p] === "object") add(t[p].domain); });
29
+ ID_FIELDS.forEach((f) => add(t[f]));
30
+ PARTS.forEach((p) => { if (t[p] && typeof t[p] === "object") ID_FIELDS.forEach((f) => add(t[p][f])); });
31
+ return out;
32
+ }
33
+
20
34
  // The key one app gives to the next for a tenant of its list: the domain, else the Microsoft tenant id.
21
35
  function suiteTenantKey(t) {
22
36
  if (!t) return "";
23
- const conn = t.connection || {};
24
- return cleanTenantKey(t.domain) || cleanTenantKey(conn.tenant_id) || cleanTenantKey(t.ms_tenant_id) || cleanTenantKey(t.tenant_id);
37
+ for (const v of candidates(t)) {
38
+ const k = cleanTenantKey(v);
39
+ if (k) return k;
40
+ }
41
+ return "";
25
42
  }
26
43
 
27
44
  // The tenant of the list that a key names: by domain or by Microsoft tenant id.
28
45
  function matchSuiteTenant(tenants, key) {
29
46
  const k = cleanTenantKey(key);
30
47
  if (!k) return null;
31
- const conn = (t) => t.connection || {};
32
- return (tenants || []).find((t) => t && [t.domain, conn(t).tenant_id, t.ms_tenant_id, t.tenant_id, conn(t).domain]
33
- .some((v) => typeof v === "string" && v.toLowerCase() === k)) || null;
48
+ return (tenants || []).find((t) => t && candidates(t).some((v) => v.toLowerCase() === k)) || null;
34
49
  }
35
50
 
36
51
  // The tenant key in the address of this page ("" without one).