@ofidj/generator-fidj 1.4.1 → 1.5.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.
|
@@ -274,6 +274,16 @@ function startModule() {
|
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
function render() {
|
|
277
|
+
// Leaving the provider's screen is a hash change, and a hash change does not
|
|
278
|
+
// reload the document: without this the shell kept its interaction state and
|
|
279
|
+
// drew that screen again over an address that no longer named one — the
|
|
280
|
+
// person asked to leave and stayed put.
|
|
281
|
+
if (interactionId && !addressedInteraction()) {
|
|
282
|
+
interactionId = "";
|
|
283
|
+
interactionError = "";
|
|
284
|
+
interaction = null;
|
|
285
|
+
interactionFailed = false;
|
|
286
|
+
}
|
|
277
287
|
// Once the mounted app owns the document the shell cannot draw over it, and
|
|
278
288
|
// its own router will try to match addresses that were never its business.
|
|
279
289
|
// So any address it does not own means starting the document again — checked
|
|
@@ -397,7 +407,9 @@ function render() {
|
|
|
397
407
|
config.title,
|
|
398
408
|
config.appId,
|
|
399
409
|
config.ownCredentials ? credentialFields() : "",
|
|
410
|
+
isFidjItself,
|
|
400
411
|
);
|
|
412
|
+
|
|
401
413
|
element("forget-hint")?.addEventListener("click", () => {
|
|
402
414
|
forgetSignIn(config.appId);
|
|
403
415
|
render();
|
|
@@ -578,6 +590,22 @@ const refusals: Record<string, string> = {
|
|
|
578
590
|
refused: "That could not be completed. Please try again.",
|
|
579
591
|
};
|
|
580
592
|
|
|
593
|
+
// Fidj's own front end, told apart by the one fact it already carries: the
|
|
594
|
+
// dashboard it points people to is itself. "Sign in with Fidj" is the right
|
|
595
|
+
// label on an app that is not Fidj; here it names a provider the person is
|
|
596
|
+
// standing in, and hides the form behind a click that only fetches it.
|
|
597
|
+
const isFidjItself = (() => {
|
|
598
|
+
try {
|
|
599
|
+
return new URL(config.dashboardUrl).origin === window.location.origin;
|
|
600
|
+
} catch {
|
|
601
|
+
return false;
|
|
602
|
+
}
|
|
603
|
+
})();
|
|
604
|
+
function addressedInteraction() {
|
|
605
|
+
const query = window.location.hash.slice(2).split("?")[1] || "";
|
|
606
|
+
return new URLSearchParams(query).get("interaction") || "";
|
|
607
|
+
}
|
|
608
|
+
|
|
581
609
|
function readInteraction() {
|
|
582
610
|
const query = window.location.hash.slice(2).split("?")[1] || "";
|
|
583
611
|
const parameters = new URLSearchParams(query);
|
|
@@ -108,6 +108,7 @@ export function providerEntry(
|
|
|
108
108
|
title: string,
|
|
109
109
|
appId: string,
|
|
110
110
|
credentials: string,
|
|
111
|
+
isFidjItself = false,
|
|
111
112
|
) {
|
|
112
113
|
const escapeText = (value: unknown) =>
|
|
113
114
|
String(value ?? "").replace(
|
|
@@ -123,10 +124,12 @@ export function providerEntry(
|
|
|
123
124
|
? `<p class="signin-lead">You signed in here with Fidj before. ${escapeText(title)} accounts are Fidj accounts — continue as yourself, or use another.</p>`
|
|
124
125
|
: both
|
|
125
126
|
? `<p class="signin-lead">${escapeText(title)} accounts are Fidj accounts. Sign in below, or let Fidj do it on its own page — where this site never sees your password.</p>`
|
|
126
|
-
:
|
|
127
|
+
: isFidjItself
|
|
128
|
+
? `<p class="signin-lead">One account across every app that uses Fidj, and a separate set of choices for each one. Sign in, or create yours, on the next screen.</p>`
|
|
129
|
+
: `<p class="signin-lead">${escapeText(title)} accounts are Fidj accounts. You will sign in — or create yours — on Fidj's own page, so this site never sees your password.</p>`;
|
|
127
130
|
const fidj = hint
|
|
128
131
|
? `<button class="primary" type="submit" name="entry" value="fidj">Continue as ${escapeText(hint)}</button><button type="button" id="forget-hint" class="quiet">Use a different account</button>`
|
|
129
|
-
: `<button class="${both ? "secondary" : "primary"}" type="submit" name="entry" value="fidj"
|
|
132
|
+
: `<button class="${both ? "secondary" : "primary"}" type="submit" name="entry" value="fidj">${isFidjItself ? "Sign in" : "Sign in with Fidj"}</button>`;
|
|
130
133
|
if (!both) return lead + agreementMarkup() + fidj;
|
|
131
134
|
// Both doors. A remembered address puts Fidj first because it is one tap; no
|
|
132
135
|
// memory puts the form first, because that is what the person came to do.
|