@7365admin1/layer-common 4.79.0 → 4.80.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 4.80.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 200cb0b: Service Providers > Invitations: the status line says who must act while an invitation waits ("Waiting for a Seven365 Super Admin to approve - the email is sent after approval") and, once approved, whether the email went out ("Email sent 30 Sept, 14:14" or "Email failed: <reason> - use Resend", in red). Reads `emailStatus` from core 3.134+; older rows keep "Sent - waiting for their answer".
8
+
3
9
  ## 4.79.0
4
10
 
5
11
  ### Minor Changes
@@ -1932,11 +1938,11 @@
1932
1938
  `utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
1933
1939
  own rule from two endpoints the console already calls, unprojected:
1934
1940
 
1935
- GET /api/members/user/:user/app/admin the Seven365 staff membership
1936
- GET /api/roles/id/:role that membership's role document
1941
+ GET /api/members/user/:user/app/admin the Seven365 staff membership
1942
+ GET /api/roles/id/:role that membership's role document
1937
1943
 
1938
- owner = member.type === "admin" && role.type === "admin" && role.default === true
1939
- staff = member.type === "admin" && role.type === "admin"
1944
+ owner = member.type === "admin" && role.type === "admin" && role.default === true
1945
+ staff = member.type === "admin" && role.type === "admin"
1940
1946
 
1941
1947
  `role.default` is the marker because it is the only property of a platform
1942
1948
  staff role no API caller can set - `role.controller.ts` validates create and
@@ -140,7 +140,11 @@
140
140
  :status="item.viewStatus || item.statusRaw || item.status"
141
141
  :label="item.status"
142
142
  />
143
- <div v-if="item.statusLine" class="mt-1 sp-sub">{{ item.statusLine }}</div>
143
+ <div
144
+ v-if="item.statusLine"
145
+ class="mt-1 sp-sub"
146
+ :class="{ 'text-error': item.statusLine.startsWith('Email failed') }"
147
+ >{{ item.statusLine }}</div>
144
148
  <!-- Was `text-caption text-medium-emphasis` - Roboto 12px at
145
149
  Vuetify's 60% opacity. The design's sub-line is `--muted`. -->
146
150
  <div v-if="item.rejectionReason" class="mt-1 sp-reject-reason">
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@7365admin1/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "4.79.0",
5
+ "version": "4.80.0",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
@@ -19,8 +19,19 @@ export type TSentInvitation = {
19
19
  createdAt?: string | null;
20
20
  answeredAt?: string | null;
21
21
  onSite?: boolean;
22
+ /** The latest invitation-email attempt, from the server (core 3.134+). */
23
+ emailStatus?: { state?: "sent" | "failed"; at?: string | null; reason?: string } | null;
22
24
  };
23
25
 
26
+ /** "30 Sep, 14:14" - when the email went out. */
27
+ export function spDayTime(value?: string | null): string {
28
+ if (!value) return "";
29
+ const d = new Date(value);
30
+ return Number.isNaN(d.getTime())
31
+ ? ""
32
+ : d.toLocaleString("en-GB", { day: "numeric", month: "short", hour: "2-digit", minute: "2-digit" });
33
+ }
34
+
24
35
  const ANSWERED: Record<string, string> = {
25
36
  complete: "Accepted",
26
37
  declined: "Declined",
@@ -91,7 +102,20 @@ export function sentStatusLine(row: TSentInvitation): string {
91
102
  return `Accepted${when ? ` on ${when}` : ""} · no longer on this site`;
92
103
  }
93
104
  if (ANSWERED[status]) return when ? `${ANSWERED[status]} on ${when}` : "";
94
- if (status === "awaiting-approval") return "Seven365 checks it before it is sent";
95
- if (status === "pending") return "Sent - waiting for their answer";
105
+ // Who has to act, and that nothing is emailed until they do.
106
+ if (status === "awaiting-approval") {
107
+ return "Waiting for a Seven365 Super Admin to approve - the email is sent after approval";
108
+ }
109
+ if (status === "pending") {
110
+ const email = row.emailStatus;
111
+ if (email?.state === "failed") {
112
+ return `Email failed: ${email.reason || "could not be sent"} - use Resend`;
113
+ }
114
+ if (email?.state === "sent") {
115
+ const when = spDayTime(email.at);
116
+ return `Email sent${when ? ` ${when}` : ""} - waiting for their answer`;
117
+ }
118
+ return "Sent - waiting for their answer";
119
+ }
96
120
  return "";
97
121
  }