@owlmeans/client-auth 0.1.18-rc.40 → 0.1.18-rc.42

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.
Files changed (59) hide show
  1. package/README.md +2 -2
  2. package/agent-meta/manifest.json +2 -2
  3. package/agent-meta/skills/client-auth/SKILL.md +10 -7
  4. package/build/components/dispatcher/component.d.ts.map +1 -1
  5. package/build/components/dispatcher/component.js +19 -12
  6. package/build/components/dispatcher/component.js.map +1 -1
  7. package/build/login/i18n/be.json +6 -2
  8. package/build/login/i18n/de.json +6 -2
  9. package/build/login/i18n/en.json +6 -2
  10. package/build/login/i18n/es.json +6 -2
  11. package/build/login/i18n/fr.json +6 -2
  12. package/build/login/i18n/pl.json +6 -2
  13. package/build/login/i18n/ru.json +6 -2
  14. package/build/login/i18n/uk.json +6 -2
  15. package/build/login/index.d.ts +2 -0
  16. package/build/login/index.d.ts.map +1 -1
  17. package/build/login/index.js +2 -0
  18. package/build/login/index.js.map +1 -1
  19. package/build/login/land.d.ts +44 -0
  20. package/build/login/land.d.ts.map +1 -0
  21. package/build/login/land.js +158 -0
  22. package/build/login/land.js.map +1 -0
  23. package/build/login/screen.d.ts.map +1 -1
  24. package/build/login/screen.js +27 -2
  25. package/build/login/screen.js.map +1 -1
  26. package/build/login/service.d.ts.map +1 -1
  27. package/build/login/service.js +20 -0
  28. package/build/login/service.js.map +1 -1
  29. package/build/login/terms-config.d.ts +59 -0
  30. package/build/login/terms-config.d.ts.map +1 -0
  31. package/build/login/terms-config.js +2 -0
  32. package/build/login/terms-config.js.map +1 -0
  33. package/build/login/terms.d.ts +38 -0
  34. package/build/login/terms.d.ts.map +1 -1
  35. package/build/login/terms.js +0 -0
  36. package/build/login/terms.js.map +1 -1
  37. package/build/login/types.d.ts +77 -0
  38. package/build/login/types.d.ts.map +1 -1
  39. package/package.json +22 -22
  40. package/src/components/dispatcher/component.tsx +25 -12
  41. package/src/login/i18n/be.json +6 -2
  42. package/src/login/i18n/de.json +6 -2
  43. package/src/login/i18n/en.json +6 -2
  44. package/src/login/i18n/es.json +6 -2
  45. package/src/login/i18n/fr.json +6 -2
  46. package/src/login/i18n/pl.json +6 -2
  47. package/src/login/i18n/ru.json +6 -2
  48. package/src/login/i18n/uk.json +6 -2
  49. package/src/login/index.ts +2 -0
  50. package/src/login/land.ts +186 -0
  51. package/src/login/screen.tsx +58 -14
  52. package/src/login/service.ts +26 -2
  53. package/src/login/terms-config.ts +49 -0
  54. package/src/login/terms.ts +0 -0
  55. package/src/login/types.ts +82 -0
  56. package/src/manager/README.md +1 -1
  57. package/tests/i18n.spec.ts +68 -0
  58. package/tests/land.spec.ts +241 -0
  59. package/tests/terms.spec.ts +202 -0
package/README.md CHANGED
@@ -12,7 +12,7 @@ legacy). The server-side counterpart is `@owlmeans/server-auth`.
12
12
  ## Installation
13
13
 
14
14
  ```bash
15
- bun add @owlmeans/client-auth@^0.1.18-rc.40
15
+ bun add @owlmeans/client-auth@^0.1.18-rc.42
16
16
  ```
17
17
 
18
18
  ## Concepts
@@ -319,7 +319,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
319
319
  your project's skill store (`.agents/skills/`):
320
320
 
321
321
  ```sh
322
- npx @owlmeans/agent-skills@^0.1.18-rc.31
322
+ npx @owlmeans/agent-skills@^0.1.18-rc.33
323
323
  ```
324
324
 
325
325
  The embedded files are version-matched to this package release. Do not edit them
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
3
  "package": "@owlmeans/client-auth",
4
- "version": "0.1.18-rc.40",
5
- "generatedAt": "2026-09-21T21:54:22.941Z",
4
+ "version": "0.1.18-rc.42",
5
+ "generatedAt": "2026-09-22T17:37:10.893Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -8,7 +8,7 @@ user-invocable: false
8
8
  # @owlmeans/client-auth
9
9
 
10
10
  **Layer:** Client
11
- **Install:** `"@owlmeans/client-auth": "^0.1.18-rc.40"` in `dependencies`
11
+ **Install:** `"@owlmeans/client-auth": "^0.1.18-rc.42"` in `dependencies`
12
12
 
13
13
  Five subpaths, five jobs:
14
14
 
@@ -87,9 +87,12 @@ browsing context the round trip can complete at all.
87
87
  | `LoginPlugin`, `LoginEnv`, `LoginRequest`, `LogoutRequest`, `LoginOutcome`, `LoginIntent`, `LoginService`, `LoginContext`, `LoginPrecondition` | The contract |
88
88
  | `registerMethodSource`, `listMethodSources`, `resolveLoginMethods`, `primaryLoginMethod` | Which sign-in methods are offered — see `login-methods` |
89
89
  | `LoginMethod`, `LoginMethodSource`, `LoginMethodContext` | Method types |
90
- | `resolveTerms`, `termsAccepted`, `acceptTerms`, `ResolvedTerms` | The confirmation, recorded in `localStorage` against a version derived from the resolved URLs |
90
+ | `landAfterLogin(ctx, opts?)`, `continueLogin(ctx, opts?)`, `landingUrl(ctx, landing)`, `useContinueLogin()` | The post-login landing decision (`src/login/land.ts`) — see `login-plugins`. `landAfterLogin` runs due landing hooks then delegates to `continueLogin`, which walks pending `LoginStep`s, then `resumeSuspendedFlow`, then `LandOptions.fallback ?? { alias: HOME }`; `landingUrl` builds the absolute URL a plugin's own `window.location.href` needs; `useContinueLogin()` is what a step's own screen calls once satisfied |
91
+ | `LoginStep`, `LoginLanding`, `LoginLandingHook`, `LandOptions`, `LoginLandingParams` | Landing-seam types. `registerStep`/`steps`/`onLanded`/`landingHooks` on `LoginService` are the same replace-by-alias, priority-sorted registries as `registerPlugin` |
92
+ | `LOGIN_STEP_TIMEOUT`, `LOGIN_LANDED_STORAGE` | A step's `pending`/a hook's `landed` is bounded by the former; the latter is where the last-landed token is recorded (the raw string, never a digest) |
93
+ | `resolveTerms`, `termsAccepted`, `acceptTerms`, `termsSentence`, `ResolvedTerms`, `ResolvedTermsDocument`, `TermsSentencePart` | The confirmation. `resolveTerms` produces `documents` (what the checkbox agrees to: terms, then billing/product/custom when configured) and `notices` (what is only disclosed: privacy, plus cookies per its own inclusion rule) — see the terms-confirmation section of `login-methods`. The extra `LoginTermsConfig` fields (`billing`, `product`, `documents`, `revisions`, `showRevision`) are added by module augmentation in `src/login/terms-config.ts`, never by editing `@owlmeans/config` — importing anything from `@owlmeans/client-auth/login` pulls it in |
91
94
  | `resolveCredit`, `ResolvedCredit` | The credit and copyright line |
92
- | `FallbackLoginScreen`, `LoginScreenProps`, `LoginScreenComponent` | The plain sign-in screen a relying party renders when no UI family registered one |
95
+ | `FallbackLoginScreen`, `LoginScreenProps` (now also carries `locale?: string`, for `Intl.ListFormat` and a custom document's locale-keyed label), `LoginScreenComponent` | The plain sign-in screen a relying party renders when no UI family registered one |
93
96
  | `surrogatePath(ctx, target)`, `SurrogateTarget` | Where a surrogate login window opens; `null` on an older entrypoint list |
94
97
  | `resumeAction(outcome)`, `ResumeAction`, `loginAttemptError(outcome)` | The one reading of a `resume` outcome, and the one reading of a finished attempt |
95
98
  | `registerNotifier(notifier)` (on `LoginService`), `LoginNotifier` | Surfaces a `begin`/`logout` outcome that has no inline screen to render it on — e.g. a toast on `LoginOutcome.Blocked` for a header "Log in"/"Log out" control. `web-panel`'s `appendLoginScreen` registers a default; unregistered, it is silence |
@@ -146,10 +149,10 @@ a web application only calls these when it builds its context by hand.
146
149
  `persist()` / `restore()` / `hasPersistentState()` / `cleanUpState()`. They keep the type, stage
147
150
  and allowance in the `FLOW_STATE` resource under an id this package owns and does not export —
148
151
  restore before submitting the credential, and clean up after.
149
- - After a sign-in, `DispatcherHOC.navigate` resumes a landing suspended in `@owlmeans/client-flow`
150
- (`resumeSuspendedFlow`, one-shot, an entrypoint alias plus its query) before it falls back to `HOME`;
151
- it is read BEFORE `alias` is defaulted to `HOME`. Login plugins that navigate on their own do the same
152
- — see `login-plugins`.
152
+ - After a sign-in, `DispatcherHOC.navigate` calls `landAfterLogin` — a pending `LoginStep`, else a
153
+ landing suspended in `@owlmeans/client-flow` (`resumeSuspendedFlow`, one-shot, an entrypoint alias
154
+ plus its query), else `HOME` — read BEFORE `alias` is defaulted to `HOME`. Login plugins that
155
+ navigate on their own do the same — see `login-plugins`.
153
156
  - The browser ends up holding an ordinary OwlMeans bearer token whichever provider issued the
154
157
  login. Product authorization stays server-side, in entrypoint gates and handler checks — never in
155
158
  client-only state.
@@ -1 +1 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/components/dispatcher/component.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA2B,cAAc,EAAE,MAAM,YAAY,CAAA;AAczE,eAAO,MAAM,aAAa,EAAE,cAyF3B,CAAA"}
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/components/dispatcher/component.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA2B,cAAc,EAAE,MAAM,YAAY,CAAA;AAezE,eAAO,MAAM,aAAa,EAAE,cAqG3B,CAAA"}
@@ -4,36 +4,43 @@ import { AUTH_QUERY, DISPATCHER } from '@owlmeans/auth';
4
4
  import { HOME } from '@owlmeans/context';
5
5
  import { DEFAULT_ALIAS, DEFAULT_ENTITY } from '../../consts.js';
6
6
  import { useNavigate } from '@owlmeans/client';
7
- import { DEFAULT_ALIAS as FLOW_SERVICE, resumeSuspendedFlow } from '@owlmeans/client-flow';
7
+ import { DEFAULT_ALIAS as FLOW_SERVICE } from '@owlmeans/client-flow';
8
8
  import { FLOW_PLACEHOLDER, OidcAuthStep, STD_OIDC_FLOW } from '@owlmeans/flow';
9
9
  import { SERVICE_PARAM } from '@owlmeans/web-flow';
10
+ import { landAfterLogin } from '../../login/land.js';
10
11
  export const DispatcherHOC = Renderer => ({ context, params, alias, query, payload }) => {
11
12
  const [forwarding, setForwarding] = useState();
12
13
  const navigator = useNavigate();
13
14
  const navigate = useCallback(async () => {
14
15
  if (alias == null || alias === DISPATCHER) {
15
16
  // A sign-in that started elsewhere — a device or authorization-code consent screen, most
16
- // commonly — suspended itself here before leaving. Resuming it takes priority over the
17
- // ordinary HOME landing, and does so BEFORE `alias` is overwritten, because once it is
18
- // `HOME` there is no way back to tell the two cases apart.
19
- const landing = await resumeSuspendedFlow(context);
20
- if (landing != null) {
21
- await navigator.navigate(context.entrypoint(landing.entrypoint), { query: landing.query });
17
+ // commonly — suspended itself here before leaving, or a registered step still has
18
+ // something to collect (a marketing-consent screen, say). `landAfterLogin` is the whole
19
+ // post-sign-in landing decision (steps, landing hooks, the suspended flow, then HOME) and
20
+ // takes priority over the ordinary HOME landing, resolved BEFORE `alias` is overwritten,
21
+ // because once it is `HOME` there is no way back to tell the cases apart.
22
+ const landing = await landAfterLogin(context);
23
+ if (landing.alias !== HOME) {
24
+ await navigator.navigate(context.entrypoint(landing.alias), { params: landing.params, query: landing.query });
22
25
  return;
23
26
  }
24
27
  alias = HOME;
25
28
  }
26
- const module = context.entrypoint(alias);
27
- if (alias === HOME) {
28
- params = {};
29
- query = {};
30
- }
31
29
  else {
30
+ // A concrete destination already exists (an OIDC `?code=` return, etc.) — a registered step
31
+ // still gets to interject, but `resumeSuspendedFlow` must not run a second time: this
32
+ // branch already has somewhere to go.
32
33
  query = { ...forwarding?.query, ...query };
33
34
  if (query != null && AUTH_QUERY in query) {
34
35
  delete query[AUTH_QUERY];
35
36
  }
37
+ const landing = await landAfterLogin(context, { fallback: { alias, params, query }, resume: false });
38
+ await navigator.navigate(context.entrypoint(landing.alias), { params: landing.params, query: landing.query });
39
+ return;
36
40
  }
41
+ const module = context.entrypoint(alias);
42
+ params = {};
43
+ query = {};
37
44
  await navigator.navigate(module, { params, query });
38
45
  }, [forwarding]);
39
46
  useEffect(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/components/dispatcher/component.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAGxD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEvD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACxC,OAA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A;IAEvB,MAAM,YAAY,GAAG,WAAW,CAA0C,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QACzF,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;IACjC,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,KAAC,QAAQ,IAAC,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAA;AACrE,CAAC,CAAA"}
@@ -16,11 +16,15 @@
16
16
  "fallback": "Працягнуць з {{method}}"
17
17
  },
18
18
  "terms": {
19
- "agreement": "Я прачытаў(-ла) і прымаю {{terms}} і {{privacy}}.",
19
+ "accept": "Я прачытаў(-ла) і прымаю {{documents}}.",
20
20
  "terms": "Умовы карыстання",
21
21
  "privacy": "Палітыку прыватнасці",
22
22
  "cookies": "Палітыку файлаў cookie",
23
- "required": "Каб працягнуць, пацвердзіце Умовы карыстання і Палітыку прыватнасці."
23
+ "billing": "Умовы аплаты",
24
+ "product": "Умовы прадукту {{product}}",
25
+ "notice": "Як мы апрацоўваем вашы асабістыя дадзеныя: {{notices}}.",
26
+ "revised": "Апошняе абнаўленне: {{date}}",
27
+ "required": "Каб працягнуць, пацвердзіце {{documents}}."
24
28
  },
25
29
  "consent": {
26
30
  "required": "Уваход захоўвае сеансавы файл cookie. Прыміце неабходныя файлы cookie, каб працягнуць."
@@ -16,11 +16,15 @@
16
16
  "fallback": "Mit {{method}} fortfahren"
17
17
  },
18
18
  "terms": {
19
- "agreement": "Ich habe die {{terms}} und die {{privacy}} gelesen und stimme ihnen zu.",
19
+ "accept": "Ich habe {{documents}} gelesen und stimme ihnen zu.",
20
20
  "terms": "Allgemeinen Geschäftsbedingungen",
21
21
  "privacy": "Datenschutzerklärung",
22
22
  "cookies": "Cookie-Richtlinie",
23
- "required": "Bitte bestätigen Sie die Allgemeinen Geschäftsbedingungen und die Datenschutzerklärung, um fortzufahren."
23
+ "billing": "Abrechnungsbedingungen",
24
+ "product": "{{product}}-Produktbedingungen",
25
+ "notice": "Wie wir Ihre personenbezogenen Daten verarbeiten: {{notices}}.",
26
+ "revised": "Zuletzt aktualisiert: {{date}}",
27
+ "required": "Bitte bestätigen Sie {{documents}}, um fortzufahren."
24
28
  },
25
29
  "consent": {
26
30
  "required": "Bei der Anmeldung wird ein Sitzungs-Cookie gespeichert. Akzeptieren Sie die notwendigen Cookies, um fortzufahren."
@@ -16,11 +16,15 @@
16
16
  "fallback": "Continue with {{method}}"
17
17
  },
18
18
  "terms": {
19
- "agreement": "I have read and agree to the {{terms}} and the {{privacy}}.",
19
+ "accept": "I have read and agree to the {{documents}}.",
20
20
  "terms": "Terms & Conditions",
21
21
  "privacy": "Privacy Policy",
22
22
  "cookies": "Cookie Policy",
23
- "required": "Please confirm the Terms & Conditions and the Privacy Policy to continue."
23
+ "billing": "Billing Terms",
24
+ "product": "{{product}} Product Terms",
25
+ "notice": "How we handle your personal data: {{notices}}.",
26
+ "revised": "Last updated: {{date}}",
27
+ "required": "Please confirm the {{documents}} to continue."
24
28
  },
25
29
  "consent": {
26
30
  "required": "Signing in stores a session cookie. Accept essential cookies to continue."
@@ -16,11 +16,15 @@
16
16
  "fallback": "Continuar con {{method}}"
17
17
  },
18
18
  "terms": {
19
- "agreement": "He leído y acepto los {{terms}} y la {{privacy}}.",
19
+ "accept": "He leído y acepto {{documents}}.",
20
20
  "terms": "Términos y Condiciones",
21
21
  "privacy": "Política de Privacidad",
22
22
  "cookies": "Política de Cookies",
23
- "required": "Confirma los Términos y Condiciones y la Política de Privacidad para continuar."
23
+ "billing": "Condiciones de Facturación",
24
+ "product": "Condiciones del Producto {{product}}",
25
+ "notice": "Cómo tratamos tus datos personales: {{notices}}.",
26
+ "revised": "Última actualización: {{date}}",
27
+ "required": "Confirma {{documents}} para continuar."
24
28
  },
25
29
  "consent": {
26
30
  "required": "Iniciar sesión guarda una cookie de sesión. Acepta las cookies esenciales para continuar."
@@ -16,11 +16,15 @@
16
16
  "fallback": "Continuer avec {{method}}"
17
17
  },
18
18
  "terms": {
19
- "agreement": "J’ai lu et j’accepte les {{terms}} et la {{privacy}}.",
19
+ "accept": "J’ai lu et j’accepte {{documents}}.",
20
20
  "terms": "conditions générales",
21
21
  "privacy": "politique de confidentialité",
22
22
  "cookies": "Politique relative aux cookies",
23
- "required": "Confirmez les conditions générales et la politique de confidentialité pour continuer."
23
+ "billing": "Conditions de facturation",
24
+ "product": "Conditions du produit {{product}}",
25
+ "notice": "Comment nous traitons vos données personnelles : {{notices}}.",
26
+ "revised": "Dernière mise à jour : {{date}}",
27
+ "required": "Confirmez {{documents}} pour continuer."
24
28
  },
25
29
  "consent": {
26
30
  "required": "La connexion enregistre un cookie de session. Acceptez les cookies essentiels pour continuer."
@@ -16,11 +16,15 @@
16
16
  "fallback": "Kontynuuj z {{method}}"
17
17
  },
18
18
  "terms": {
19
- "agreement": "Przeczytałem(-am) i akceptuję {{terms}} oraz {{privacy}}.",
19
+ "accept": "Przeczytałem(-am) i akceptuję {{documents}}.",
20
20
  "terms": "Regulamin",
21
21
  "privacy": "Politykę prywatności",
22
22
  "cookies": "Politykę plików cookie",
23
- "required": "Aby kontynuować, potwierdź Regulamin i Politykę prywatności."
23
+ "billing": "Warunki rozliczeń",
24
+ "product": "Warunki produktu {{product}}",
25
+ "notice": "Jak przetwarzamy Twoje dane osobowe: {{notices}}.",
26
+ "revised": "Ostatnia aktualizacja: {{date}}",
27
+ "required": "Aby kontynuować, potwierdź {{documents}}."
24
28
  },
25
29
  "consent": {
26
30
  "required": "Logowanie zapisuje plik cookie sesji. Zaakceptuj niezbędne pliki cookie, aby kontynuować."
@@ -16,11 +16,15 @@
16
16
  "fallback": "Продолжить с {{method}}"
17
17
  },
18
18
  "terms": {
19
- "agreement": "Я прочитал(а) и принимаю {{terms}} и {{privacy}}.",
19
+ "accept": "Я прочитал(а) и принимаю {{documents}}.",
20
20
  "terms": "Условия использования",
21
21
  "privacy": "Политику конфиденциальности",
22
22
  "cookies": "Политику файлов cookie",
23
- "required": "Чтобы продолжить, подтвердите Условия использования и Политику конфиденциальности."
23
+ "billing": "Условия оплаты",
24
+ "product": "Условия использования продукта {{product}}",
25
+ "notice": "Как мы обрабатываем ваши персональные данные: {{notices}}.",
26
+ "revised": "Последнее обновление: {{date}}",
27
+ "required": "Чтобы продолжить, подтвердите {{documents}}."
24
28
  },
25
29
  "consent": {
26
30
  "required": "Вход сохраняет сессионный файл cookie. Примите необходимые файлы cookie, чтобы продолжить."
@@ -16,11 +16,15 @@
16
16
  "fallback": "Продовжити з {{method}}"
17
17
  },
18
18
  "terms": {
19
- "agreement": "Я прочитав(-ла) і приймаю {{terms}} та {{privacy}}.",
19
+ "accept": "Я прочитав(-ла) і приймаю {{documents}}.",
20
20
  "terms": "Умови користування",
21
21
  "privacy": "Політику конфіденційності",
22
22
  "cookies": "Політику файлів cookie",
23
- "required": "Щоб продовжити, підтвердьте Умови користування та Політику конфіденційності."
23
+ "billing": "Умови оплати",
24
+ "product": "Умови продукту {{product}}",
25
+ "notice": "Як ми обробляємо ваші персональні дані: {{notices}}.",
26
+ "revised": "Востаннє оновлено: {{date}}",
27
+ "required": "Щоб продовжити, підтвердьте {{documents}}."
24
28
  },
25
29
  "consent": {
26
30
  "required": "Вхід зберігає сеансовий файл cookie. Прийміть необхідні файли cookie, щоб продовжити."
@@ -6,10 +6,12 @@ export * from './adopt.js';
6
6
  export * from './methods.js';
7
7
  export * from './flow.js';
8
8
  export * from './resume.js';
9
+ export * from './terms-config.js';
9
10
  export * from './terms.js';
10
11
  export * from './credit.js';
11
12
  export * from './surrogate.js';
12
13
  export * from './screen.js';
13
14
  export * from './service.js';
14
15
  export * from './hook.js';
16
+ export * from './land.js';
15
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/login/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,CAAA;AAElB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/login/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,CAAA;AAElB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA"}
@@ -6,10 +6,12 @@ export * from './adopt.js';
6
6
  export * from './methods.js';
7
7
  export * from './flow.js';
8
8
  export * from './resume.js';
9
+ export * from './terms-config.js';
9
10
  export * from './terms.js';
10
11
  export * from './credit.js';
11
12
  export * from './surrogate.js';
12
13
  export * from './screen.js';
13
14
  export * from './service.js';
14
15
  export * from './hook.js';
16
+ export * from './land.js';
15
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/login/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,CAAA;AAElB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/login/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,CAAA;AAElB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA"}
@@ -0,0 +1,44 @@
1
+ import type { LandOptions, LoginContext, LoginLanding } from './types.js';
2
+ /**
3
+ * Bound on a single step's `pending` check, or a landing hook's `landed` call.
4
+ *
5
+ * A step/hook that hangs must never hang sign-in itself — both `continueLogin` and
6
+ * `landAfterLogin` treat a timeout exactly like a rejection: fail OPEN, never block.
7
+ */
8
+ export declare const LOGIN_STEP_TIMEOUT = 5000;
9
+ /** Where a browser records the last token a landing hook has already run for. */
10
+ export declare const LOGIN_LANDED_STORAGE = "_owlmeans-login-landed";
11
+ /**
12
+ * Where a finished sign-in should go: the first pending step, else a suspended flow, else the
13
+ * fallback (ordinarily `HOME`).
14
+ *
15
+ * Re-checks `env().surrogate` even though {@link landAfterLogin} already did — this function is
16
+ * also called directly (e.g. from {@link useContinueLogin}, after the surrogate window has
17
+ * already closed), and the check is cheap insurance either way: **no step and no landing hook
18
+ * ever runs inside the surrogate popup.** It has nothing of its own to collect and nowhere to
19
+ * navigate — the popup's own `DispatcherHOC` has no `navigate() → HOME` at all.
20
+ */
21
+ export declare const continueLogin: (ctx: LoginContext, opts?: LandOptions) => Promise<LoginLanding>;
22
+ /**
23
+ * The whole post-sign-in landing decision: run any due landing hooks for a freshly seen token,
24
+ * then delegate to {@link continueLogin} for where the flow actually goes.
25
+ *
26
+ * This is what a plugin that just adopted a token calls in place of the old inline
27
+ * "`resumeSuspendedFlow` else `HOME`" — `DispatcherHOC`, the supervisor plugin and both Google
28
+ * plugins all replace their own copy of that logic with this one.
29
+ */
30
+ export declare const landAfterLogin: (ctx: LoginContext, opts?: LandOptions) => Promise<LoginLanding>;
31
+ /**
32
+ * The absolute URL a landing resolves to — the same shape the supervisor and Google plugins
33
+ * already build their own `window.location.href` from.
34
+ */
35
+ export declare const landingUrl: (ctx: LoginContext, landing: LoginLanding) => Promise<string>;
36
+ /**
37
+ * For a component that runs its own post-login step (the marketing-consent screen, for one) to
38
+ * call once it is satisfied — moves the flow on to the next step, or the ordinary landing.
39
+ *
40
+ * Not async at the call site by accident of its own — it is a callback a component holds and
41
+ * fires later, so nothing here needs the synchronous-gesture discipline `useLogin`/`useLogout` do.
42
+ */
43
+ export declare const useContinueLogin: () => ((opts?: LandOptions) => Promise<void>);
44
+ //# sourceMappingURL=land.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"land.d.ts","sourceRoot":"","sources":["../../src/login/land.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAgB,MAAM,YAAY,CAAA;AAEvF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,OAAQ,CAAA;AAEvC,iFAAiF;AACjF,eAAO,MAAM,oBAAoB,2BAA2B,CAAA;AA4D5D;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,QAAe,YAAY,SAAS,WAAW,KAAG,OAAO,CAAC,YAAY,CA+C/F,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,QAAe,YAAY,SAAS,WAAW,KAAG,OAAO,CAAC,YAAY,CAWhG,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,QAAe,YAAY,WAAW,YAAY,KAAG,OAAO,CAAC,MAAM,CAGvF,CAAA;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,QAAO,CAAC,CAAC,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAQzE,CAAA"}
@@ -0,0 +1,158 @@
1
+ import { useCallback } from 'react';
2
+ import { DISPATCHER } from '@owlmeans/auth';
3
+ import { HOME } from '@owlmeans/context';
4
+ import { useContext, useNavigate } from '@owlmeans/client';
5
+ import { resumeSuspendedFlow } from '@owlmeans/client-flow';
6
+ import { DEFAULT_ALIAS as AUTH_ALIAS } from '../consts.js';
7
+ import { ensureLoginService } from './service.js';
8
+ /**
9
+ * Bound on a single step's `pending` check, or a landing hook's `landed` call.
10
+ *
11
+ * A step/hook that hangs must never hang sign-in itself — both `continueLogin` and
12
+ * `landAfterLogin` treat a timeout exactly like a rejection: fail OPEN, never block.
13
+ */
14
+ export const LOGIN_STEP_TIMEOUT = 5_000;
15
+ /** Where a browser records the last token a landing hook has already run for. */
16
+ export const LOGIN_LANDED_STORAGE = '_owlmeans-login-landed';
17
+ /**
18
+ * Race a promise against a bound, resolving `undefined` (never rejecting) on timeout.
19
+ *
20
+ * A synchronous throw from the wrapped call is turned into a rejection by the caller before this
21
+ * ever sees it, so the only two outcomes here are "settled in time" and "timed out".
22
+ */
23
+ const withTimeout = async (promise, ms) => {
24
+ let timer;
25
+ try {
26
+ return await Promise.race([
27
+ promise,
28
+ new Promise(resolve => { timer = setTimeout(() => resolve(undefined), ms); }),
29
+ ]);
30
+ }
31
+ finally {
32
+ if (timer != null) {
33
+ clearTimeout(timer);
34
+ }
35
+ }
36
+ };
37
+ /**
38
+ * Run every registered landing hook, once per distinct token.
39
+ *
40
+ * The stored token is overwritten BEFORE the hooks run, not after: a hook that throws or hangs
41
+ * must never make the same token re-run the whole set on the next call, since surviving exactly
42
+ * that is what the bound-and-swallow contract is for. The raw token string is the marker rather
43
+ * than a digest of it — it never leaves the browser, and this package already keeps the terms
44
+ * acceptance marker the same way (`LOGIN_TERMS_STORAGE`).
45
+ */
46
+ const runLandingHooks = async (ctx, login, timeout) => {
47
+ const auth = ctx.service(AUTH_ALIAS);
48
+ const token = await auth.authenticated();
49
+ if (token == null) {
50
+ return;
51
+ }
52
+ let last = null;
53
+ try {
54
+ last = window.localStorage.getItem(LOGIN_LANDED_STORAGE);
55
+ }
56
+ catch {
57
+ // Storage can be unavailable (private modes, blocked cookies). Treated as "never landed",
58
+ // which just re-runs the hooks — the safe direction, same as the terms-acceptance marker.
59
+ }
60
+ if (last === token) {
61
+ return;
62
+ }
63
+ try {
64
+ window.localStorage.setItem(LOGIN_LANDED_STORAGE, token);
65
+ }
66
+ catch { /* nothing to remember if storage was never available */ }
67
+ for (const hook of login.landingHooks()) {
68
+ await withTimeout(Promise.resolve().then(() => hook.landed(ctx)), timeout).catch(() => undefined);
69
+ }
70
+ };
71
+ /**
72
+ * Where a finished sign-in should go: the first pending step, else a suspended flow, else the
73
+ * fallback (ordinarily `HOME`).
74
+ *
75
+ * Re-checks `env().surrogate` even though {@link landAfterLogin} already did — this function is
76
+ * also called directly (e.g. from {@link useContinueLogin}, after the surrogate window has
77
+ * already closed), and the check is cheap insurance either way: **no step and no landing hook
78
+ * ever runs inside the surrogate popup.** It has nothing of its own to collect and nowhere to
79
+ * navigate — the popup's own `DispatcherHOC` has no `navigate() → HOME` at all.
80
+ */
81
+ export const continueLogin = async (ctx, opts) => {
82
+ const login = ensureLoginService(ctx);
83
+ if (login.env().surrogate) {
84
+ return { alias: DISPATCHER };
85
+ }
86
+ const timeout = opts?.stepTimeout ?? LOGIN_STEP_TIMEOUT;
87
+ const auth = ctx.service(AUTH_ALIAS);
88
+ const token = await auth.authenticated();
89
+ if (token != null) {
90
+ const steps = login.steps();
91
+ let start = 0;
92
+ if (opts?.after != null) {
93
+ const index = steps.findIndex(step => step.alias === opts.after);
94
+ if (index >= 0) {
95
+ start = index + 1;
96
+ }
97
+ }
98
+ for (let i = start; i < steps.length; i++) {
99
+ const step = steps[i];
100
+ // Registration proves only that some module reached the bundle — the step's own screen may
101
+ // not be bound in this tree (an older target, a partial import). Skipped, never thrown.
102
+ if (!ctx.hasEntrypoint(step.entrypoint)) {
103
+ continue;
104
+ }
105
+ // A step that throws or hangs must never block sign-in: fail OPEN, i.e. "not pending".
106
+ const pending = await withTimeout(Promise.resolve().then(() => step.pending(ctx)), timeout).catch(() => false);
107
+ if (pending === true) {
108
+ return { alias: step.entrypoint, query: await step.query?.(ctx), step: step.alias };
109
+ }
110
+ }
111
+ }
112
+ if (opts?.resume !== false) {
113
+ const landing = await resumeSuspendedFlow(ctx);
114
+ if (landing != null) {
115
+ return { alias: landing.entrypoint, query: landing.query };
116
+ }
117
+ }
118
+ return opts?.fallback ?? { alias: HOME };
119
+ };
120
+ /**
121
+ * The whole post-sign-in landing decision: run any due landing hooks for a freshly seen token,
122
+ * then delegate to {@link continueLogin} for where the flow actually goes.
123
+ *
124
+ * This is what a plugin that just adopted a token calls in place of the old inline
125
+ * "`resumeSuspendedFlow` else `HOME`" — `DispatcherHOC`, the supervisor plugin and both Google
126
+ * plugins all replace their own copy of that logic with this one.
127
+ */
128
+ export const landAfterLogin = async (ctx, opts) => {
129
+ const login = ensureLoginService(ctx);
130
+ // Never run a step or a landing hook while THIS document is the surrogate popup — see the note
131
+ // on `continueLogin`.
132
+ if (login.env().surrogate) {
133
+ return { alias: DISPATCHER };
134
+ }
135
+ await runLandingHooks(ctx, login, opts?.stepTimeout ?? LOGIN_STEP_TIMEOUT);
136
+ return continueLogin(ctx, opts);
137
+ };
138
+ /**
139
+ * The absolute URL a landing resolves to — the same shape the supervisor and Google plugins
140
+ * already build their own `window.location.href` from.
141
+ */
142
+ export const landingUrl = async (ctx, landing) => await ctx.entrypoint(landing.alias).url({ params: landing.params, query: landing.query }, { absolute: true });
143
+ /**
144
+ * For a component that runs its own post-login step (the marketing-consent screen, for one) to
145
+ * call once it is satisfied — moves the flow on to the next step, or the ordinary landing.
146
+ *
147
+ * Not async at the call site by accident of its own — it is a callback a component holds and
148
+ * fires later, so nothing here needs the synchronous-gesture discipline `useLogin`/`useLogout` do.
149
+ */
150
+ export const useContinueLogin = () => {
151
+ const context = useContext();
152
+ const nav = useNavigate();
153
+ return useCallback(async (opts) => {
154
+ const landing = await continueLogin(context, opts);
155
+ await nav.go(landing.alias, { params: landing.params, query: landing.query });
156
+ }, [context, nav]);
157
+ };
158
+ //# sourceMappingURL=land.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"land.js","sourceRoot":"","sources":["../../src/login/land.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAEnC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAG1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,aAAa,IAAI,UAAU,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAGjD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAA;AAEvC,iFAAiF;AACjF,MAAM,CAAC,MAAM,oBAAoB,GAAG,wBAAwB,CAAA;AAE5D;;;;;GAKG;AACH,MAAM,WAAW,GAAG,KAAK,EAAK,OAAmB,EAAE,EAAU,EAA0B,EAAE;IACvF,IAAI,KAAgD,CAAA;IACpD,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,IAAI,CAAgB;YACvC,OAAO;YACP,IAAI,OAAO,C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.ts","sourceRoot":"","sources":["../../src/login/screen.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,EAAE,EAAa,MAAM,OAAO,CAAA;AAGzD,OAAO,KAAK,EAA6B,gBAAgB,EAAgB,MAAM,YAAY,CAAA;AAgE3F;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,gBAAgB,CAkGpD,CAAA"}