@7365admin1/layer-common 4.97.1-staging.623 → 4.97.1-staging.624
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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@7365admin1/layer-common",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "4.97.1-staging.
|
|
5
|
+
"version": "4.97.1-staging.624",
|
|
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.",
|
|
@@ -39,6 +39,19 @@ export const LOOKUP_TIMEOUT_MS = 5000;
|
|
|
39
39
|
*/
|
|
40
40
|
export const SEND_SITE = false;
|
|
41
41
|
|
|
42
|
+
/*
|
|
43
|
+
* Per app opt in, ahead of the switch above: an app that sets
|
|
44
|
+
* `runtimeConfig.public.roleFollowsSite` to true (or the env var
|
|
45
|
+
* `NUXT_PUBLIC_ROLE_FOLLOWS_SITE=true`) sends the site now, so its role follows
|
|
46
|
+
* the site while every other app keeps today's answer. Declare the key in the
|
|
47
|
+
* APP's own nuxt.config, never in this layer's, or an env var in any app's
|
|
48
|
+
* deploy could turn it on there. Absent or misspelled means off.
|
|
49
|
+
*/
|
|
50
|
+
export function roleFollowsSite(): boolean {
|
|
51
|
+
const value = useRuntimeConfig().public.roleFollowsSite;
|
|
52
|
+
return SEND_SITE || value === true || value === "true";
|
|
53
|
+
}
|
|
54
|
+
|
|
42
55
|
function bounded<T>(request: Promise<T>): Promise<T> {
|
|
43
56
|
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
44
57
|
const timeout = new Promise<never>((_, reject) => {
|
|
@@ -111,7 +124,7 @@ export default defineNuxtPlugin(() => {
|
|
|
111
124
|
// it when the answer can actually DIFFER: the first resolution, or a site
|
|
112
125
|
// change while Q16 is on. While Q16 is held a site change re-asks the same
|
|
113
126
|
// question, so the resolved role stays on screen and nothing flickers.
|
|
114
|
-
if (resolvedFor === null ||
|
|
127
|
+
if (resolvedFor === null || roleFollowsSite()) userAppRoleStatus.value = "loading";
|
|
115
128
|
inFlightKey = key;
|
|
116
129
|
inFlight = run(userId, site, staffOrg).finally(() => {
|
|
117
130
|
inFlight = null;
|
|
@@ -139,7 +152,7 @@ export default defineNuxtPlugin(() => {
|
|
|
139
152
|
// adds is Q16 itself. Sending `org` as well would change the fallback
|
|
140
153
|
// too, and that is a separate change.
|
|
141
154
|
const member = await bounded(
|
|
142
|
-
getByUserType(userId, APP, undefined,
|
|
155
|
+
getByUserType(userId, APP, undefined, roleFollowsSite() && site ? site : undefined),
|
|
143
156
|
);
|
|
144
157
|
hasMemberDocument = true;
|
|
145
158
|
id.value = member.org ?? "";
|