@ofidj/generator-fidj 3.10.1 → 3.10.2

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.
@@ -325,6 +325,22 @@ const RECOGNITION_ASKED = "fidj.oidc.recognition-asked";
325
325
  // for. Asking there sent an anonymous visitor to the provider and back, and what
326
326
  // they had asked to read never rendered.
327
327
  const PUBLIC_ROUTE = "pub";
328
+ // Whether the question is still outstanding. Drawing the credential form and
329
+ // then navigating to the provider loses whatever somebody had begun typing, so
330
+ // the entry waits instead — the answer takes one redirect, not a wait worth a
331
+ // spinner's worth of ceremony, and it says what it is doing.
332
+ let recognising = false;
333
+ function mightBeRecognised() {
334
+ if (!oidc || !isFidjItself) return false;
335
+ if ((moduleRoute() || "").split("/")[0] === PUBLIC_ROUTE) return false;
336
+ if (oidc.signedOutHere()) return false;
337
+ try {
338
+ return sessionStorage.getItem(RECOGNITION_ASKED) !== "true";
339
+ } catch {
340
+ return false;
341
+ }
342
+ }
343
+
328
344
  async function askWhetherFidjKnowsThisBrowser() {
329
345
  if (!oidc || !isFidjItself || sdk.isLoggedIn() || oidc.signedOutHere())
330
346
  return false;
@@ -582,6 +598,10 @@ function render() {
582
598
  renderNav("content");
583
599
  return;
584
600
  }
601
+ if (recognising) {
602
+ root.innerHTML = `<section class="signin-shell"><div class="signin-form"><p role="status">Checking whether you are already signed in to Fidj…</p></div></section>`;
603
+ return;
604
+ }
585
605
  // Only the entry reaches here now: the privacy screen and the account
586
606
  // screen became one, and that one is drawn above.
587
607
  root.innerHTML = `<section class="signin-shell"><div class="signin-intro${config.highlights?.length ? "" : " is-plain"}"><header class="signin-masthead"><img class="app-mark" src="${escape(config.logo)}" alt=""><strong>${escape(config.title)}</strong></header>
@@ -1119,6 +1139,7 @@ if (relayProviderAnswer()) {
1119
1139
 
1120
1140
  function boot() {
1121
1141
  window.addEventListener("hashchange", render);
1142
+ recognising = mightBeRecognised();
1122
1143
  render();
1123
1144
  if (readInteraction()) {
1124
1145
  render();
@@ -1167,6 +1188,7 @@ function boot() {
1167
1188
  apiEndpoint: config.apiEndpoint,
1168
1189
  prod: !config.localDemo,
1169
1190
  });
1191
+ recognising = recognising && !sdk.isLoggedIn();
1170
1192
  if (sdk.isLoggedIn()) {
1171
1193
  await refresh();
1172
1194
  if (!moduleRoute() && !accountRoutes.includes(currentRoute()))
@@ -1174,6 +1196,8 @@ function boot() {
1174
1196
  return;
1175
1197
  }
1176
1198
  // Nothing held here. Fidj may still know this browser from an app.
1177
- await askWhetherFidjKnowsThisBrowser();
1199
+ if (await askWhetherFidjKnowsThisBrowser()) return;
1200
+ recognising = false;
1201
+ render();
1178
1202
  });
1179
1203
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ofidj/generator-fidj",
3
- "version": "3.10.1",
3
+ "version": "3.10.2",
4
4
  "description": "Generate a TypeScript app with Fidj sign-in, live server-side roles and per-app privacy.",
5
5
  "homepage": "https://fidj.ovh",
6
6
  "bugs": {