@7365admin1/layer-common 4.73.1-staging.460 → 4.73.1-staging.461

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.
@@ -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.73.1-staging.460",
5
+ "version": "4.73.1-staging.461",
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
  }