@owlmeans/client-auth 0.1.18-rc.9 → 0.1.18

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 (255) hide show
  1. package/README.md +283 -37
  2. package/agent-meta/manifest.json +50 -4
  3. package/agent-meta/skills/client-auth/SKILL.md +84 -55
  4. package/agent-meta/skills/client-auth/parts/login.md +77 -0
  5. package/agent-meta/skills/client-auth/parts/manager.md +37 -0
  6. package/build/components/dispatcher/component.d.ts.map +1 -1
  7. package/build/components/dispatcher/component.js +26 -6
  8. package/build/components/dispatcher/component.js.map +1 -1
  9. package/build/components/dispatcher/types.local.d.ts +7 -0
  10. package/build/components/dispatcher/types.local.d.ts.map +1 -0
  11. package/build/components/dispatcher/types.local.js +2 -0
  12. package/build/components/dispatcher/types.local.js.map +1 -0
  13. package/build/entrypoints.d.ts +7 -0
  14. package/build/entrypoints.d.ts.map +1 -0
  15. package/build/entrypoints.js +7 -0
  16. package/build/entrypoints.js.map +1 -0
  17. package/build/helper.d.ts +2 -1
  18. package/build/helper.d.ts.map +1 -1
  19. package/build/helper.js +28 -5
  20. package/build/helper.js.map +1 -1
  21. package/build/index.d.ts +1 -1
  22. package/build/index.d.ts.map +1 -1
  23. package/build/index.js +1 -1
  24. package/build/index.js.map +1 -1
  25. package/build/login/adopt/types.d.ts +26 -0
  26. package/build/login/adopt/types.d.ts.map +1 -0
  27. package/build/login/adopt/types.js +2 -0
  28. package/build/login/adopt/types.js.map +1 -0
  29. package/build/login/adopt.d.ts +7 -12
  30. package/build/login/adopt.d.ts.map +1 -1
  31. package/build/login/adopt.js +15 -14
  32. package/build/login/adopt.js.map +1 -1
  33. package/build/login/consts.d.ts +89 -4
  34. package/build/login/consts.d.ts.map +1 -1
  35. package/build/login/consts.js +93 -5
  36. package/build/login/consts.js.map +1 -1
  37. package/build/login/consts.local.d.ts +16 -0
  38. package/build/login/consts.local.d.ts.map +1 -0
  39. package/build/login/consts.local.js +30 -0
  40. package/build/login/consts.local.js.map +1 -0
  41. package/build/login/credit/types.d.ts +7 -0
  42. package/build/login/credit/types.d.ts.map +1 -0
  43. package/build/login/credit/types.js +2 -0
  44. package/build/login/credit/types.js.map +1 -0
  45. package/build/login/credit.d.ts +19 -0
  46. package/build/login/credit.d.ts.map +1 -0
  47. package/build/login/credit.js +58 -0
  48. package/build/login/credit.js.map +1 -0
  49. package/build/login/env/types.d.ts +35 -0
  50. package/build/login/env/types.d.ts.map +1 -0
  51. package/build/login/env/types.js +2 -0
  52. package/build/login/env/types.js.map +1 -0
  53. package/build/login/env.d.ts +5 -29
  54. package/build/login/env.d.ts.map +1 -1
  55. package/build/login/env.js +63 -80
  56. package/build/login/env.js.map +1 -1
  57. package/build/login/flow.d.ts +20 -0
  58. package/build/login/flow.d.ts.map +1 -0
  59. package/build/login/flow.js +39 -0
  60. package/build/login/flow.js.map +1 -0
  61. package/build/login/hook.d.ts +30 -4
  62. package/build/login/hook.d.ts.map +1 -1
  63. package/build/login/hook.js +53 -18
  64. package/build/login/hook.js.map +1 -1
  65. package/build/login/i18n/be.json +41 -0
  66. package/build/login/i18n/de.json +41 -0
  67. package/build/login/i18n/en.json +41 -0
  68. package/build/login/i18n/es.json +41 -0
  69. package/build/login/i18n/fr.json +41 -0
  70. package/build/login/i18n/pl.json +41 -0
  71. package/build/login/i18n/ru.json +41 -0
  72. package/build/login/i18n/uk.json +41 -0
  73. package/build/login/i18n.d.ts +2 -0
  74. package/build/login/i18n.d.ts.map +1 -0
  75. package/build/login/i18n.js +27 -0
  76. package/build/login/i18n.js.map +1 -0
  77. package/build/login/index.d.ts +20 -0
  78. package/build/login/index.d.ts.map +1 -1
  79. package/build/login/index.js +11 -0
  80. package/build/login/index.js.map +1 -1
  81. package/build/login/land/types.d.ts +52 -0
  82. package/build/login/land/types.d.ts.map +1 -0
  83. package/build/login/land/types.js +2 -0
  84. package/build/login/land/types.js.map +1 -0
  85. package/build/login/land.d.ts +6 -0
  86. package/build/login/land.d.ts.map +1 -0
  87. package/build/login/land.js +122 -0
  88. package/build/login/land.js.map +1 -0
  89. package/build/login/methods/types.d.ts +30 -0
  90. package/build/login/methods/types.d.ts.map +1 -0
  91. package/build/login/methods/types.js +2 -0
  92. package/build/login/methods/types.js.map +1 -0
  93. package/build/login/methods.d.ts +7 -0
  94. package/build/login/methods.d.ts.map +1 -0
  95. package/build/login/methods.js +87 -0
  96. package/build/login/methods.js.map +1 -0
  97. package/build/login/resume/types.d.ts +24 -0
  98. package/build/login/resume/types.d.ts.map +1 -0
  99. package/build/login/resume/types.js +2 -0
  100. package/build/login/resume/types.js.map +1 -0
  101. package/build/login/resume.d.ts +9 -0
  102. package/build/login/resume.d.ts.map +1 -0
  103. package/build/login/resume.js +38 -0
  104. package/build/login/resume.js.map +1 -0
  105. package/build/login/screen.d.ts +17 -0
  106. package/build/login/screen.d.ts.map +1 -0
  107. package/build/login/screen.js +66 -0
  108. package/build/login/screen.js.map +1 -0
  109. package/build/login/service.d.ts +6 -5
  110. package/build/login/service.d.ts.map +1 -1
  111. package/build/login/service.js +141 -15
  112. package/build/login/service.js.map +1 -1
  113. package/build/login/start/types.d.ts +29 -0
  114. package/build/login/start/types.d.ts.map +1 -0
  115. package/build/login/start/types.js +2 -0
  116. package/build/login/start/types.js.map +1 -0
  117. package/build/login/start.d.ts +5 -0
  118. package/build/login/start.d.ts.map +1 -0
  119. package/build/login/start.js +36 -0
  120. package/build/login/start.js.map +1 -0
  121. package/build/login/surrogate/types.d.ts +9 -0
  122. package/build/login/surrogate/types.d.ts.map +1 -0
  123. package/build/login/surrogate/types.js +2 -0
  124. package/build/login/surrogate/types.js.map +1 -0
  125. package/build/login/surrogate.d.ts +13 -0
  126. package/build/login/surrogate.d.ts.map +1 -0
  127. package/build/login/surrogate.js +33 -0
  128. package/build/login/surrogate.js.map +1 -0
  129. package/build/login/terms/types.d.ts +112 -0
  130. package/build/login/terms/types.d.ts.map +1 -0
  131. package/build/login/terms/types.js +2 -0
  132. package/build/login/terms/types.js.map +1 -0
  133. package/build/login/terms-config.d.ts +65 -0
  134. package/build/login/terms-config.d.ts.map +1 -0
  135. package/build/login/terms-config.js +2 -0
  136. package/build/login/terms-config.js.map +1 -0
  137. package/build/login/terms.d.ts +21 -0
  138. package/build/login/terms.d.ts.map +1 -0
  139. package/build/login/terms.js +235 -0
  140. package/build/login/terms.js.map +1 -0
  141. package/build/login/types.d.ts +223 -16
  142. package/build/login/types.d.ts.map +1 -1
  143. package/build/login/types.js +1 -16
  144. package/build/login/types.js.map +1 -1
  145. package/build/manager/components/authentication/control.js +3 -3
  146. package/build/manager/components/authentication/control.js.map +1 -1
  147. package/build/manager/components/authentication/types.d.ts +2 -2
  148. package/build/manager/components/authentication/types.d.ts.map +1 -1
  149. package/build/manager/components/tunnel-consumer.js +2 -2
  150. package/build/manager/components/tunnel-consumer.js.map +1 -1
  151. package/build/manager/entrypoints.d.ts +11 -0
  152. package/build/manager/entrypoints.d.ts.map +1 -0
  153. package/build/manager/entrypoints.js +17 -0
  154. package/build/manager/entrypoints.js.map +1 -0
  155. package/build/manager/plugins/basic-ed25519.d.ts.map +1 -1
  156. package/build/manager/plugins/basic-ed25519.js +5 -0
  157. package/build/manager/plugins/basic-ed25519.js.map +1 -1
  158. package/build/manager/plugins/exports.d.ts +3 -0
  159. package/build/manager/plugins/exports.d.ts.map +1 -1
  160. package/build/manager/plugins/exports.js +2 -0
  161. package/build/manager/plugins/exports.js.map +1 -1
  162. package/build/manager/plugins/index.d.ts +2 -5
  163. package/build/manager/plugins/index.d.ts.map +1 -1
  164. package/build/manager/plugins/index.js +9 -1
  165. package/build/manager/plugins/index.js.map +1 -1
  166. package/build/manager/plugins/methods.d.ts +6 -0
  167. package/build/manager/plugins/methods.d.ts.map +1 -0
  168. package/build/manager/plugins/methods.js +65 -0
  169. package/build/manager/plugins/methods.js.map +1 -0
  170. package/build/manager/plugins/re-captcha.d.ts.map +1 -1
  171. package/build/manager/plugins/re-captcha.js +5 -0
  172. package/build/manager/plugins/re-captcha.js.map +1 -1
  173. package/build/manager/plugins/registry/types.d.ts +10 -0
  174. package/build/manager/plugins/registry/types.d.ts.map +1 -0
  175. package/build/manager/plugins/registry/types.js +2 -0
  176. package/build/manager/plugins/registry/types.js.map +1 -0
  177. package/build/manager/plugins/registry.d.ts +20 -0
  178. package/build/manager/plugins/registry.d.ts.map +1 -0
  179. package/build/manager/plugins/registry.js +23 -0
  180. package/build/manager/plugins/registry.js.map +1 -0
  181. package/build/manager/plugins/tunnel-consumer.d.ts.map +1 -1
  182. package/build/manager/plugins/tunnel-consumer.js +10 -3
  183. package/build/manager/plugins/tunnel-consumer.js.map +1 -1
  184. package/build/manager/plugins/types.d.ts +53 -0
  185. package/build/manager/plugins/types.d.ts.map +1 -1
  186. package/build/modules.d.ts.map +1 -1
  187. package/build/service.js +1 -1
  188. package/build/service.js.map +1 -1
  189. package/package.json +33 -30
  190. package/src/components/dispatcher/component.tsx +37 -14
  191. package/src/components/dispatcher/types.local.ts +7 -0
  192. package/src/entrypoints.ts +10 -0
  193. package/src/helper.ts +31 -5
  194. package/src/index.ts +1 -1
  195. package/src/login/adopt/types.ts +25 -0
  196. package/src/login/adopt.ts +21 -14
  197. package/src/login/consts.local.ts +34 -0
  198. package/src/login/consts.ts +105 -5
  199. package/src/login/credit/types.ts +6 -0
  200. package/src/login/credit.ts +69 -0
  201. package/src/login/env/types.ts +35 -0
  202. package/src/login/env.ts +60 -72
  203. package/src/login/flow.ts +44 -0
  204. package/src/login/hook.ts +58 -22
  205. package/src/login/i18n/be.json +41 -0
  206. package/src/login/i18n/de.json +41 -0
  207. package/src/login/i18n/en.json +41 -0
  208. package/src/login/i18n/es.json +41 -0
  209. package/src/login/i18n/fr.json +41 -0
  210. package/src/login/i18n/pl.json +41 -0
  211. package/src/login/i18n/ru.json +41 -0
  212. package/src/login/i18n/uk.json +41 -0
  213. package/src/login/i18n.ts +29 -0
  214. package/src/login/index.ts +21 -0
  215. package/src/login/land/types.ts +54 -0
  216. package/src/login/land.ts +149 -0
  217. package/src/login/methods/types.ts +32 -0
  218. package/src/login/methods.ts +109 -0
  219. package/src/login/resume/types.ts +24 -0
  220. package/src/login/resume.ts +45 -0
  221. package/src/login/screen.tsx +140 -0
  222. package/src/login/service.ts +181 -18
  223. package/src/login/start/types.ts +30 -0
  224. package/src/login/start.ts +44 -0
  225. package/src/login/surrogate/types.ts +9 -0
  226. package/src/login/surrogate.ts +37 -0
  227. package/src/login/terms/types.ts +126 -0
  228. package/src/login/terms-config.ts +55 -0
  229. package/src/login/terms.ts +315 -0
  230. package/src/login/types.ts +233 -17
  231. package/src/manager/README.md +37 -80
  232. package/src/manager/components/authentication/control.ts +3 -3
  233. package/src/manager/components/authentication/types.ts +2 -2
  234. package/src/manager/components/tunnel-consumer.tsx +2 -2
  235. package/src/manager/entrypoints.ts +18 -0
  236. package/src/manager/plugins/basic-ed25519.tsx +7 -0
  237. package/src/manager/plugins/exports.ts +3 -0
  238. package/src/manager/plugins/index.ts +11 -4
  239. package/src/manager/plugins/methods.ts +74 -0
  240. package/src/manager/plugins/re-captcha.tsx +7 -0
  241. package/src/manager/plugins/registry/types.ts +10 -0
  242. package/src/manager/plugins/registry.ts +33 -0
  243. package/src/manager/plugins/tunnel-consumer.tsx +12 -3
  244. package/src/manager/plugins/types.ts +54 -0
  245. package/src/service.ts +1 -1
  246. package/tests/context.ts +1 -2
  247. package/tests/i18n.spec.ts +68 -0
  248. package/tests/land.spec.ts +292 -0
  249. package/tests/login.spec.ts +332 -0
  250. package/tests/target.spec.ts +210 -0
  251. package/tests/terms-deferred.spec.ts +65 -0
  252. package/tests/terms.spec.ts +314 -0
  253. package/build/.gitkeep +0 -0
  254. package/src/manager/modules.ts +0 -18
  255. package/src/modules.ts +0 -13
@@ -0,0 +1,52 @@
1
+ import type { LoginLandingParams } from '../types.js';
2
+ /** Where a finished sign-in (or a pending step) lands. */
3
+ export interface LoginLanding {
4
+ alias: string;
5
+ params?: LoginLandingParams;
6
+ query?: LoginLandingParams;
7
+ /** The step alias this landing came from, when it came from one. */
8
+ step?: string;
9
+ }
10
+ /** Options for {@link LoginService.landAfterLogin}-shaped helpers (./land.js). */
11
+ export interface LandOptions {
12
+ /** Where to land when nothing else claims the flow. Defaults to `{ alias: HOME }`. */
13
+ fallback?: LoginLanding;
14
+ /** `false` skips `resumeSuspendedFlow` — the caller already has its own concrete destination. */
15
+ resume?: boolean;
16
+ /** Skip every step up to and including this alias — the resume point for a step's re-entry. */
17
+ after?: string;
18
+ /**
19
+ * Overrides the step/hook timeout for this call. Mainly for tests; production callers leave it
20
+ * at the default (`LOGIN_STEP_TIMEOUT`).
21
+ */
22
+ stepTimeout?: number;
23
+ }
24
+ /** Where one context's finished sign-in goes: its pending steps, a suspended flow, or the fallback. */
25
+ export interface LoginLandingHelper {
26
+ /**
27
+ * Where a finished sign-in should go: the first pending step, else a suspended flow, else the
28
+ * fallback (ordinarily `HOME`).
29
+ *
30
+ * Re-checks `env().surrogate` even though {@link landAfterLogin} already did — this function is
31
+ * also called directly (e.g. from `useContinueLogin`, after the surrogate window has already
32
+ * closed), and the check is cheap insurance either way: **no step and no landing hook ever runs
33
+ * inside the surrogate popup.** It has nothing of its own to collect and nowhere to navigate —
34
+ * the popup's own `DispatcherHOC` has no `navigate() → HOME` at all.
35
+ */
36
+ continueLogin: (opts?: LandOptions) => Promise<LoginLanding>;
37
+ /**
38
+ * The whole post-sign-in landing decision: run any due landing hooks for a freshly seen token,
39
+ * then delegate to {@link continueLogin} for where the flow actually goes.
40
+ *
41
+ * This is what a plugin that just adopted a token calls in place of the old inline
42
+ * "`resumeSuspendedFlow` else `HOME`" — `DispatcherHOC`, the supervisor plugin and both Google
43
+ * plugins all replace their own copy of that logic with this one.
44
+ */
45
+ landAfterLogin: (opts?: LandOptions) => Promise<LoginLanding>;
46
+ /**
47
+ * The absolute URL a landing resolves to — the same shape the supervisor and Google plugins
48
+ * already build their own `window.location.href` from.
49
+ */
50
+ landingUrl: (landing: LoginLanding) => Promise<string>;
51
+ }
52
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/login/land/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAErD,0DAA0D;AAC1D,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,kBAAkB,CAAA;IAC3B,KAAK,CAAC,EAAE,kBAAkB,CAAA;IAC1B,oEAAoE;IACpE,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,kFAAkF;AAClF,MAAM,WAAW,WAAW;IAC1B,sFAAsF;IACtF,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,iGAAiG;IACjG,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,+FAA+F;IAC/F,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,uGAAuG;AACvG,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;OASG;IACH,aAAa,EAAE,CAAC,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,YAAY,CAAC,CAAA;IAC5D;;;;;;;OAOG;IACH,cAAc,EAAE,CAAC,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,YAAY,CAAC,CAAA;IAC7D;;;OAGG;IACH,UAAU,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CACvD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/login/land/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import type { LoginContext } from './types.js';
2
+ import type { LoginLandingHelper } from './land/types.js';
3
+ export declare const makeLoginLandingHelper: (ctx: LoginContext) => LoginLandingHelper;
4
+ /** The landing helper of a context — one per context. */
5
+ export declare const loginLandingOf: (target: LoginContext) => LoginLandingHelper;
6
+ //# sourceMappingURL=land.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"land.d.ts","sourceRoot":"","sources":["../../src/login/land.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,YAAY,CAAA;AAC5D,OAAO,KAAK,EAA6B,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AA6BpF,eAAO,MAAM,sBAAsB,QAAS,YAAY,KAAG,kBA4G1D,CAAA;AAED,yDAAyD;AACzD,eAAO,MAAM,cAAc,8CAA6C,CAAA"}
@@ -0,0 +1,122 @@
1
+ import { DISPATCHER } from '@owlmeans/auth';
2
+ import { HOME, memoHelper } from '@owlmeans/context';
3
+ import { DEFAULT_ALIAS as AUTH_ALIAS } from '../consts.js';
4
+ import { ensureLoginService } from './service.js';
5
+ import { LOGIN_LANDED_STORAGE, LOGIN_STEP_TIMEOUT } from './consts.js';
6
+ import { flowLandingOf } from '@owlmeans/client-flow';
7
+ /**
8
+ * Race a promise against a bound, resolving to `onTimeout` (never rejecting) if the bound wins.
9
+ *
10
+ * A synchronous throw from the wrapped call is turned into a rejection by the caller before this
11
+ * ever sees it, so the only two outcomes here are "settled in time" and "timed out". `onTimeout`
12
+ * defaults to `undefined` — every existing caller that omits it keeps its old fail-open meaning;
13
+ * `continueLogin` passes a step's own `required` flag through it so a step that hangs is read the
14
+ * same way as one that throws.
15
+ */
16
+ const withTimeout = async (promise, ms, onTimeout) => {
17
+ let timer;
18
+ try {
19
+ return await Promise.race([
20
+ promise,
21
+ new Promise(resolve => { timer = setTimeout(() => resolve(onTimeout), ms); }),
22
+ ]);
23
+ }
24
+ finally {
25
+ if (timer != null) {
26
+ clearTimeout(timer);
27
+ }
28
+ }
29
+ };
30
+ export const makeLoginLandingHelper = (ctx) => {
31
+ /**
32
+ * Run every registered landing hook, once per distinct token.
33
+ *
34
+ * The stored token is overwritten BEFORE the hooks run, not after: a hook that throws or hangs
35
+ * must never make the same token re-run the whole set on the next call, since surviving exactly
36
+ * that is what the bound-and-swallow contract is for. The raw token string is the marker rather
37
+ * than a digest of it — it never leaves the browser, and this package already keeps the terms
38
+ * acceptance marker the same way (`LOGIN_TERMS_STORAGE`).
39
+ */
40
+ const runLandingHooks = async (login, timeout) => {
41
+ const auth = ctx.service(AUTH_ALIAS);
42
+ const token = await auth.authenticated();
43
+ if (token == null) {
44
+ return;
45
+ }
46
+ let last = null;
47
+ try {
48
+ last = window.localStorage.getItem(LOGIN_LANDED_STORAGE);
49
+ }
50
+ catch {
51
+ // Storage can be unavailable (private modes, blocked cookies). Treated as "never landed",
52
+ // which just re-runs the hooks — the safe direction, same as the terms-acceptance marker.
53
+ }
54
+ if (last === token) {
55
+ return;
56
+ }
57
+ try {
58
+ window.localStorage.setItem(LOGIN_LANDED_STORAGE, token);
59
+ }
60
+ catch { /* nothing to remember if storage was never available */ }
61
+ for (const hook of login.landingHooks()) {
62
+ await withTimeout(Promise.resolve().then(() => hook.landed(ctx)), timeout).catch(() => undefined);
63
+ }
64
+ };
65
+ const continueLogin = async (opts) => {
66
+ const login = ensureLoginService(ctx);
67
+ if (login.env().surrogate) {
68
+ return { alias: DISPATCHER };
69
+ }
70
+ const timeout = opts?.stepTimeout ?? LOGIN_STEP_TIMEOUT;
71
+ const auth = ctx.service(AUTH_ALIAS);
72
+ const token = await auth.authenticated();
73
+ if (token != null) {
74
+ const steps = login.steps();
75
+ let start = 0;
76
+ if (opts?.after != null) {
77
+ const index = steps.findIndex(step => step.alias === opts.after);
78
+ if (index >= 0) {
79
+ start = index + 1;
80
+ }
81
+ }
82
+ for (let i = start; i < steps.length; i++) {
83
+ const step = steps[i];
84
+ // Registration proves only that some module reached the bundle — the step's own screen may
85
+ // not be bound in this tree (an older target, a partial import). Skipped, never thrown.
86
+ if (!ctx.hasEntrypoint(step.entrypoint)) {
87
+ continue;
88
+ }
89
+ // A step that throws or hangs fails OPEN ("not pending") by default — UNLESS it declared
90
+ // itself `required`, in which case a broken read must show the step rather than let the
91
+ // person through it unconfirmed (a Terms box moved here from the sign-in screen).
92
+ const onBroken = step.required === true;
93
+ const pending = await withTimeout(Promise.resolve().then(() => step.pending(ctx)), timeout, onBroken).catch(() => onBroken);
94
+ if (pending === true) {
95
+ return { alias: step.entrypoint, query: await step.query?.(ctx), step: step.alias };
96
+ }
97
+ }
98
+ }
99
+ if (opts?.resume !== false) {
100
+ const landing = await flowLandingOf(ctx).resumeSuspendedFlow();
101
+ if (landing != null) {
102
+ return { alias: landing.entrypoint, query: landing.query };
103
+ }
104
+ }
105
+ return opts?.fallback ?? { alias: HOME };
106
+ };
107
+ const landAfterLogin = async (opts) => {
108
+ const login = ensureLoginService(ctx);
109
+ // Never run a step or a landing hook while THIS document is the surrogate popup — see the note
110
+ // on `continueLogin`.
111
+ if (login.env().surrogate) {
112
+ return { alias: DISPATCHER };
113
+ }
114
+ await runLandingHooks(login, opts?.stepTimeout ?? LOGIN_STEP_TIMEOUT);
115
+ return continueLogin(opts);
116
+ };
117
+ const landingUrl = async (landing) => await ctx.entrypoint(landing.alias).url({ params: landing.params, query: landing.query }, { absolute: true });
118
+ return { continueLogin, landAfterLogin, landingUrl };
119
+ };
120
+ /** The landing helper of a context — one per context. */
121
+ export const loginLandingOf = memoHelper.oncePer(makeLoginLandingHelper);
122
+ //# sourceMappingURL=land.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"land.js","sourceRoot":"","sources":["../../src/login/land.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAGpD,OAAO,EAAE,aAAa,IAAI,UAAU,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAGjD,OAAO,EAAE,oBAAoB,EAA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,EAAE,QAAQ,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;IAC1C,CAAC,CAAA;IAED,MAAM,cAAc,GAAG,KAAK,EAAE,IAAkB,EAAyB,EAAE;QACzE,MAAM,KAAK,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAA;QACrC,+FAA+F;QAC/F,sBAAsB;QACtB,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC;YAC1B,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,CAAA;QAC9B,CAAC;QAED,MAAM,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,WAAW,IAAI,kBAAkB,CAAC,CAAA;QAErE,OAAO,aAAa,CAAC,IAAI,CAAC,CAAA;IAC5B,CAAC,CAAA;IAED,MAAM,UAAU,GAAG,KAAK,EAAE,OAAqB,EAAmB,EAAE,CAClE,MAAM,GAAG,CAAC,UAAU,CAA2B,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAC/D,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CACrE,CAAA;IAEH,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,CAAA;AACtD,CAAC,CAAA;AAED,yDAAyD;AACzD,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAA"}
@@ -0,0 +1,30 @@
1
+ import type { LoginScreenConfig } from '@owlmeans/config';
2
+ import type { LoginMethod, LoginMethodContext, LoginMethodSource } from '../types.js';
3
+ /** The sign-in methods on offer: the global source registry and the resolution of a screen's list. */
4
+ export interface LoginMethodsHelper {
5
+ /** Register a source globally — replacing an earlier one of the same alias. */
6
+ registerMethodSource: (source: LoginMethodSource) => void;
7
+ /** The globally registered sources, in registration order. */
8
+ listMethodSources: () => LoginMethodSource[];
9
+ /**
10
+ * Everything the current environment may be offered, in the order it should be offered in.
11
+ *
12
+ * Resolution order matters and is not arbitrary:
13
+ *
14
+ * 1. Sources produce candidates. A source that throws is skipped rather than taking the screen
15
+ * down — a misconfigured provider list must not remove the sign-in method that does work.
16
+ * 2. `restricted` candidates are dropped unless the configuration named them, which is what makes
17
+ * an operator login opt-in rather than merely unadvertised.
18
+ * 3. An explicit `methods` list is both a filter AND the order, because an app that bothered to
19
+ * list them means that list.
20
+ */
21
+ resolveLoginMethods: (ctx: LoginMethodContext, cfg?: LoginScreenConfig, extra?: LoginMethodSource[]) => LoginMethod[];
22
+ /**
23
+ * The method a screen highlights and focuses.
24
+ *
25
+ * The first `primary` one, else the first offered. It is highlighted, never started: requirement
26
+ * one of this whole feature is that nothing leaves the document without a click.
27
+ */
28
+ primaryLoginMethod: (methods: LoginMethod[]) => LoginMethod | null;
29
+ }
30
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/login/methods/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAErF,sGAAsG;AACtG,MAAM,WAAW,kBAAkB;IACjC,+EAA+E;IAC/E,oBAAoB,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,CAAA;IACzD,8DAA8D;IAC9D,iBAAiB,EAAE,MAAM,iBAAiB,EAAE,CAAA;IAC5C;;;;;;;;;;;OAWG;IACH,mBAAmB,EAAE,CACnB,GAAG,EAAE,kBAAkB,EAAE,GAAG,CAAC,EAAE,iBAAiB,EAAE,KAAK,CAAC,EAAE,iBAAiB,EAAE,KAC1E,WAAW,EAAE,CAAA;IAClB;;;;;OAKG;IACH,kBAAkB,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,GAAG,IAAI,CAAA;CACnE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/login/methods/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import type { LoginMethod } from './types.js';
2
+ import type { LoginMethodsHelper } from './methods/types.js';
3
+ export declare const createLoginMethodsHelper: () => LoginMethodsHelper;
4
+ export declare const loginMethodsHelper: LoginMethodsHelper;
5
+ /** @deprecated compat:factory-refactor — use `loginMethodsHelper.primaryLoginMethod(…)` */
6
+ export declare const primaryLoginMethod: (methods: LoginMethod[]) => LoginMethod | null;
7
+ //# sourceMappingURL=methods.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"methods.d.ts","sourceRoot":"","sources":["../../src/login/methods.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAyC,MAAM,YAAY,CAAA;AACpF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAmB5D,eAAO,MAAM,wBAAwB,QAAO,kBAgF3C,CAAA;AAED,eAAO,MAAM,kBAAkB,oBAA6B,CAAA;AAE5D,2FAA2F;AAC3F,eAAO,MAAM,kBAAkB,YAAa,WAAW,EAAE,KAAG,WAAW,GAAG,IAC1B,CAAA"}
@@ -0,0 +1,87 @@
1
+ import { DEFAULT_METHOD_ORDER } from './consts.js';
2
+ import { logger } from '@owlmeans/log';
3
+ const log = logger('client-auth:login');
4
+ /**
5
+ * The module-global registry of method SOURCES.
6
+ *
7
+ * A source, rather than a method, because the two things that offer sign-in methods answer
8
+ * different questions at different times: the plugin registry knows what code is loaded, and the
9
+ * OIDC configuration knows what an entity is federated with. Both are answered per render — a
10
+ * provider list can arrive from the api-config middleware after the first paint.
11
+ *
12
+ * Global, like the `AuthenticationPlugin` map it mirrors, because a package registers its source
13
+ * from a side-effect import that has no context to hang it on. A context-scoped registry exists
14
+ * alongside it on the login service, and both are merged by `resolveLoginMethods`.
15
+ */
16
+ const sources = [];
17
+ export const createLoginMethodsHelper = () => {
18
+ const registerMethodSource = (source) => {
19
+ const existing = sources.findIndex(candidate => candidate.alias === source.alias);
20
+ if (existing >= 0) {
21
+ sources.splice(existing, 1);
22
+ }
23
+ sources.push(source);
24
+ };
25
+ const listMethodSources = () => [...sources];
26
+ /** Normalize a config entry, which may be a bare id or a full override object. */
27
+ const asConfig = (entry) => typeof entry === 'string' ? { id: entry } : entry;
28
+ const merge = (method, override) => override == null ? method : {
29
+ ...method,
30
+ ...(override.label != null ? { label: override.label } : {}),
31
+ ...(override.i18nKey != null ? { i18nKey: override.i18nKey } : {}),
32
+ ...(override.icon != null ? { icon: override.icon } : {}),
33
+ ...(override.order != null ? { order: override.order } : {}),
34
+ ...(override.emphasis != null ? { emphasis: override.emphasis } : {}),
35
+ ...(override.params != null ? { params: { ...method.params, ...override.params } } : {}),
36
+ };
37
+ const resolveLoginMethods = (ctx, cfg, extra = []) => {
38
+ const candidates = [];
39
+ for (const source of [...sources, ...extra]) {
40
+ try {
41
+ candidates.push(...source.list(ctx));
42
+ }
43
+ catch (e) {
44
+ log.warn('Login method source failed', { source: source.alias, error: e });
45
+ }
46
+ }
47
+ const overrides = cfg?.overrides ?? {};
48
+ const listed = cfg?.methods?.map(asConfig);
49
+ const listedIds = listed?.map(entry => entry.id).filter((id) => id != null);
50
+ const offered = candidates
51
+ .filter(method => {
52
+ const override = overrides[method.id] ?? listed?.find(entry => entry.id === method.id);
53
+ if (override?.enabled === false || override?.hidden === true) {
54
+ return false;
55
+ }
56
+ // A restricted method is offered only where the configuration asked for it — by naming it in
57
+ // `methods`, or by enabling it in `overrides`. Registering the plugin is deliberately not
58
+ // enough: an operator login that appears wherever its code happens to be bundled is an
59
+ // operator login in production.
60
+ if (method.restricted === true
61
+ && listedIds?.includes(method.id) !== true
62
+ && override?.enabled !== true) {
63
+ return false;
64
+ }
65
+ return true;
66
+ })
67
+ .map(method => merge(method, overrides[method.id]));
68
+ if (listedIds != null) {
69
+ return listedIds
70
+ .map(id => {
71
+ const method = offered.find(candidate => candidate.id === id);
72
+ return method != null ? merge(method, listed?.find(entry => entry.id === id)) : null;
73
+ })
74
+ .filter((method) => method != null);
75
+ }
76
+ return offered.sort((a, b) => {
77
+ const order = (a.order ?? DEFAULT_METHOD_ORDER) - (b.order ?? DEFAULT_METHOD_ORDER);
78
+ return order !== 0 ? order : a.id.localeCompare(b.id);
79
+ });
80
+ };
81
+ const primaryLoginMethod = (methods) => methods.find(method => method.emphasis === 'primary') ?? methods[0] ?? null;
82
+ return { registerMethodSource, listMethodSources, resolveLoginMethods, primaryLoginMethod };
83
+ };
84
+ export const loginMethodsHelper = createLoginMethodsHelper();
85
+ /** @deprecated compat:factory-refactor — use `loginMethodsHelper.primaryLoginMethod(…)` */
86
+ export const primaryLoginMethod = (methods) => loginMethodsHelper.primaryLoginMethod(methods);
87
+ //# sourceMappingURL=methods.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"methods.js","sourceRoot":"","sources":["../../src/login/methods.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAGlD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAEtC,MAAM,GAAG,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAA;AAEvC;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,GAAwB,EAAE,CAAA;AAEvC,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAuB,EAAE;IAC/D,MAAM,oBAAoB,GAAG,CAAC,MAAyB,EAAQ,EAAE;QAC/D,MAAM,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK,CAAC,CAAA;QACjF,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;YAClB,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAA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AAoB,CAAC,CAAA;YACnF,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;QACvD,CAAC,CAAC,CAAA;IACJ,CAAC,CAAA;IAED,MAAM,kBAAkB,GAAG,CAAC,OAAsB,EAAsB,EAAE,CACxE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,KAAK,SAAS,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAA;IAE7E,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,CAAA;AAC7F,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,wBAAwB,EAAE,CAAA;AAE5D,2FAA2F;AAC3F,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAsB,EAAsB,EAAE,CAC/E,kBAAkB,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAA"}
@@ -0,0 +1,24 @@
1
+ import type { LoginOutcome, ResumeAction } from '../consts.js';
2
+ /** How a settled sign-in outcome is read: by a screen that stayed put, and by a resuming dispatcher. */
3
+ export interface LoginResumeHelper {
4
+ /**
5
+ * The message key a FINISHED sign-in attempt should show, or null when it actually went somewhere.
6
+ *
7
+ * A dispatcher may treat `Passed` as "carry on with the ordinary continuation", because it has one.
8
+ * A screen does not: the user clicked, the document did not move, and nothing rendered — which is
9
+ * indistinguishable from a broken button, and is exactly how a null authorization URL used to
10
+ * present itself. Every outcome that leaves the user looking at the same screen therefore has to
11
+ * say something.
12
+ */
13
+ loginAttemptError: (outcome: LoginOutcome | null) => string | null;
14
+ /**
15
+ * The one reading of a `resume` outcome, shared by every dispatcher.
16
+ *
17
+ * Shared because three dispatchers — `web-client`, `web-oidc-rp` and `mui-oidc-rp` — have to agree
18
+ * on it, and the last time they each held their own copy of a decision they drifted, which is how a
19
+ * popup came to render the application inside itself in two packages at once. It is also the whole
20
+ * rule, so it is testable without a DOM.
21
+ */
22
+ resumeAction: (outcome: LoginOutcome) => ResumeAction;
23
+ }
24
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/login/resume/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE9D,wGAAwG;AACxG,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;OAQG;IACH,iBAAiB,EAAE,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,KAAK,MAAM,GAAG,IAAI,CAAA;IAClE;;;;;;;OAOG;IACH,YAAY,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,YAAY,CAAA;CACtD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/login/resume/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import { LoginOutcome, ResumeAction } from './consts.js';
2
+ import type { LoginResumeHelper } from './resume/types.js';
3
+ export declare const createLoginResumeHelper: () => LoginResumeHelper;
4
+ export declare const loginResumeHelper: LoginResumeHelper;
5
+ /** @deprecated compat:factory-refactor — use `loginResumeHelper.loginAttemptError(…)` */
6
+ export declare const loginAttemptError: (outcome: LoginOutcome | null) => string | null;
7
+ /** @deprecated compat:factory-refactor — use `loginResumeHelper.resumeAction(…)` */
8
+ export declare const resumeAction: (outcome: LoginOutcome) => ResumeAction;
9
+ //# sourceMappingURL=resume.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resume.d.ts","sourceRoot":"","sources":["../../src/login/resume.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE1D,eAAO,MAAM,uBAAuB,QAAO,iBAgC1C,CAAA;AAED,eAAO,MAAM,iBAAiB,mBAA4B,CAAA;AAE1D,yFAAyF;AACzF,eAAO,MAAM,iBAAiB,YAAa,YAAY,GAAG,IAAI,KAAG,MAAM,GAAG,IAC5B,CAAA;AAE9C,oFAAoF;AACpF,eAAO,MAAM,YAAY,YAAa,YAAY,KAAG,YAAuD,CAAA"}
@@ -0,0 +1,38 @@
1
+ import { LoginOutcome, ResumeAction } from './consts.js';
2
+ export const createLoginResumeHelper = () => {
3
+ const loginAttemptError = (outcome) => {
4
+ switch (outcome) {
5
+ case LoginOutcome.Gesture:
6
+ case LoginOutcome.Blocked:
7
+ // The window never opened. That is the popup blocker, and it has its own copy.
8
+ return 'login.error.blocked';
9
+ case LoginOutcome.Failed:
10
+ case LoginOutcome.Passed:
11
+ return 'login.error.failed';
12
+ default:
13
+ // Handled, Redirected and Orphaned all did something; Orphaned reports itself elsewhere.
14
+ return null;
15
+ }
16
+ };
17
+ const resumeAction = (outcome) => {
18
+ switch (outcome) {
19
+ case LoginOutcome.Handled:
20
+ case LoginOutcome.Redirected:
21
+ return ResumeAction.Stop;
22
+ case LoginOutcome.Orphaned:
23
+ case LoginOutcome.Failed:
24
+ case LoginOutcome.Gesture:
25
+ case LoginOutcome.Blocked:
26
+ return ResumeAction.Render;
27
+ default:
28
+ return ResumeAction.Navigate;
29
+ }
30
+ };
31
+ return { loginAttemptError, resumeAction };
32
+ };
33
+ export const loginResumeHelper = createLoginResumeHelper();
34
+ /** @deprecated compat:factory-refactor — use `loginResumeHelper.loginAttemptError(…)` */
35
+ export const loginAttemptError = (outcome) => loginResumeHelper.loginAttemptError(outcome);
36
+ /** @deprecated compat:factory-refactor — use `loginResumeHelper.resumeAction(…)` */
37
+ export const resumeAction = (outcome) => loginResumeHelper.resumeAction(outcome);
38
+ //# sourceMappingURL=resume.js.map
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C,iBAAiB,CAAC,OAAO,CAAC,CAAA;AAE9C,oFAAoF;AACpF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAqB,EAAgB,EAAE,CAAC,iBAAiB,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA"}
@@ -0,0 +1,17 @@
1
+ import { type FC } from 'react';
2
+ import type { LoginScreenProps } from './types.js';
3
+ /**
4
+ * The sign-in screen every application gets, whether or not it registered a styled one.
5
+ *
6
+ * It exists because a relying party must render SOMETHING rather than start a flow on its own, and
7
+ * a relying party may not depend on a UI family. So this is deliberately plain: raw elements and
8
+ * inline styles, no Tailwind class that a consumer's stylesheet would have to scan for, no shadcn
9
+ * primitive a consumer would have to vendor. An application that registers a real screen through
10
+ * `login().registerScreen(...)` never sees it.
11
+ *
12
+ * Because it is the floor rather than the design, it still has to be correct: it offers the same
13
+ * methods, enforces the same terms confirmation, centres the same way, and renders the same
14
+ * credit line.
15
+ */
16
+ export declare const FallbackLoginScreen: FC<LoginScreenProps>;
17
+ //# sourceMappingURL=screen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screen.d.ts","sourceRoot":"","sources":["../../src/login/screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6C,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAA;AAG1F,OAAO,KAAK,EAA6B,gBAAgB,EAAgB,MAAM,YAAY,CAAA;AAoB3F;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,gBAAgB,CAuGpD,CAAA"}
@@ -0,0 +1,66 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useCallback, useState } from 'react';
3
+ import { useContext } from '@owlmeans/client';
4
+ import { LOGIN_SERVICE } from './consts.js';
5
+ import { loginMethodsHelper } from './methods.js';
6
+ import { loginTermsHelper } from './terms.js';
7
+ import { resolveCredit } from './credit.js';
8
+ import { box, page } from './consts.local.js';
9
+ const renderParts = (parts) => parts.map((part, index) => part.href != null
10
+ ? _jsx("a", { href: part.href, target: "_blank", rel: "noreferrer noopener", children: part.text }, index)
11
+ : _jsx("span", { children: part.text }, index));
12
+ const button = (emphasis) => ({
13
+ display: 'block', width: '100%', marginTop: '.5rem', padding: '.625rem 1rem',
14
+ fontSize: '1rem', cursor: 'pointer', borderRadius: '.375rem',
15
+ border: '1px solid currentColor',
16
+ ...(emphasis === 'primary' ? { fontWeight: 600 } : {}),
17
+ });
18
+ /**
19
+ * The sign-in screen every application gets, whether or not it registered a styled one.
20
+ *
21
+ * It exists because a relying party must render SOMETHING rather than start a flow on its own, and
22
+ * a relying party may not depend on a UI family. So this is deliberately plain: raw elements and
23
+ * inline styles, no Tailwind class that a consumer's stylesheet would have to scan for, no shadcn
24
+ * primitive a consumer would have to vendor. An application that registers a real screen through
25
+ * `login().registerScreen(...)` never sees it.
26
+ *
27
+ * Because it is the floor rather than the design, it still has to be correct: it offers the same
28
+ * methods, enforces the same terms confirmation, centres the same way, and renders the same
29
+ * credit line.
30
+ */
31
+ export const FallbackLoginScreen = props => {
32
+ const context = useContext();
33
+ const t = props.translate ?? ((_key, defaultValue) => defaultValue);
34
+ const cfg = props.config ?? context.cfg.security?.auth?.login;
35
+ const brand = context.cfg.brand;
36
+ const login = context.service(LOGIN_SERVICE);
37
+ const env = login.env();
38
+ const resolved = loginTermsHelper.resolveTerms(props.terms ?? cfg?.terms);
39
+ const credit = resolveCredit(cfg?.credit, brand, context.cfg.service);
40
+ const resolveLabel = loginTermsHelper.termsLabelResolver(t, props.locale);
41
+ const deferred = loginTermsHelper.termsDeferred(context);
42
+ const [accepted, setAccepted] = useState(() => loginTermsHelper.termsAccepted(resolved));
43
+ const [attempted, setAttempted] = useState(false);
44
+ const all = login.methods({ context, env });
45
+ const methods = typeof props.methods === 'function'
46
+ ? props.methods(all)
47
+ : props.methods ?? all;
48
+ const primary = loginMethodsHelper.primaryLoginMethod(methods);
49
+ const blocked = resolved != null && resolved.required && !deferred && !accepted;
50
+ const select = useCallback((method) => {
51
+ if (blocked) {
52
+ setAttempted(true);
53
+ return;
54
+ }
55
+ void method.start({ context, env });
56
+ }, [blocked, context, env]);
57
+ const onAccept = useCallback((value) => {
58
+ setAccepted(value);
59
+ setAttempted(false);
60
+ loginTermsHelper.acceptTerms(resolved, value);
61
+ }, [resolved]);
62
+ return _jsx("div", { "data-login-screen": true, style: page, children: _jsxs("div", { style: box, children: [_jsx("h1", { style: { fontSize: '1.25rem', marginBottom: '.25rem' }, children: props.title ?? t('login.title', 'Sign in') }), _jsx("p", { style: { opacity: .75, marginTop: 0 }, children: props.subtitle ?? t('login.subtitle', 'Choose how you would like to continue.') }), methods.length < 1
63
+ ? _jsx("p", { role: "status", children: t('login.empty', 'No sign-in method is configured for this application.') })
64
+ : methods.map(method => _jsx("button", { type: "button", "data-login-method": method.id, "aria-disabled": blocked, "data-blocked": blocked ? 'true' : undefined, style: { ...button(method.emphasis), opacity: blocked ? .6 : 1 }, autoFocus: method.id === primary?.id, onClick: () => select(method), children: method.label ?? t(`login.method.${method.i18nKey ?? method.id}`, method.id) }, method.id)), resolved != null && !deferred && _jsx("p", { style: { marginTop: '1rem', fontSize: '.875rem' }, children: _jsxs("label", { children: [_jsx("input", { type: "checkbox", checked: accepted, "data-login-terms": true, onChange: event => onAccept(event.target.checked) }), ' ', renderParts(loginTermsHelper.termsSentence(t('login.terms.accept', 'I have read and agree to the {{documents}}.'), resolved, props.locale, resolveLabel))] }) }), resolved?.revisedAt != null && !deferred && _jsx("p", { "data-login-revised": true, style: { fontSize: '.75rem', opacity: .7 }, children: t('login.terms.revised', 'Last updated: {{date}}').split('{{date}}').join(resolved.revisedAt) }), resolved != null && _jsx("p", { "data-login-privacy": true, style: { fontSize: '.875rem' }, children: renderParts(loginTermsHelper.termsSentence(t('login.terms.notice', 'How we handle your personal data: {{notices}}.'), resolved, props.locale, resolveLabel)) }), attempted && blocked && resolved != null && _jsx("p", { role: "alert", style: { color: '#b00', fontSize: '.875rem' }, children: renderParts(loginTermsHelper.termsSentence(t('login.terms.required', 'Please confirm the {{documents}} to continue.'), resolved, props.locale, resolveLabel)) }), props.footer ?? _jsxs("p", { style: { marginTop: '2rem', fontSize: '.75rem', opacity: .7 }, children: [credit.poweredBy && _jsx("span", { children: t('login.credit.powered', 'Powered by OwlMeans') }), credit.poweredBy && credit.line != null && ' · ', credit.line] })] }) });
65
+ };
66
+ //# sourceMappingURL=screen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screen.js","sourceRoot":"","sources":["../../src/login/screen.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAA+C,MAAM,OAAO,CAAA;AAC1F,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAI7C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAE7C,MAAM,WAAW,GAAG,CAAC,KAA0B,EAAa,EAAE,CAC5D,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI;IAC1C,CAAC,CAAC,YAAe,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAC,QAAQ,EAAC,GAAG,EAAC,qBAAqB,YAAE,IAAI,CAAC,IAAI,IAA5E,KAAK,CAA4E;IAC3F,CAAC,CAAC,yBAAmB,IAAI,CAAC,IAAI,IAAjB,KAAK,CAAoB,CAAC,CAAA;AAE3C,MAAM,MAAM,GAAG,CAAC,QAAiB,EAAiB,EAAE,CAAC,CAAC;IACpD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,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AE,EAAE,aAC9E,MAAM,CAAC,SAAS,IAAI,yBAAO,CAAC,CAAC,sBAAsB,EAAE,qBAAqB,CAAC,GAAQ,EACnF,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,IAAI,IAAI,IAAI,IAAI,KAAK,EAChD,MAAM,CAAC,IAAI,IACV,IACA,GAAM,CAAA;AACd,CAAC,CAAA"}
@@ -1,5 +1,5 @@
1
- import type { BasicConfig, BasicContext } from '@owlmeans/context';
2
- import { LoginOutcome } from './types.js';
1
+ import { type BasicConfig, type BasicContext } from '@owlmeans/context';
2
+ import { LoginOutcome } from './consts.js';
3
3
  import type { LoginService, LoginServiceAppend } from './types.js';
4
4
  /**
5
5
  * Login service = plugin host. It holds a registry of login plugins and, on every facade call,
@@ -14,9 +14,10 @@ import type { LoginService, LoginServiceAppend } from './types.js';
14
14
  * stage. `context.service()` throws for an uninitialized non-lazy service, which would make
15
15
  * `ensureLoginService` fail exactly where apps are told to call it.
16
16
  *
17
- * `begin` is deliberately NOT `async`. An async facade method defers the plugin's body past a
18
- * microtask boundary, and a `window.open` that lands after the user gesture has finished being
19
- * handled is eaten by the popup blocker. The same rule binds every plugin's own `begin`.
17
+ * `begin` and `logout` are deliberately NOT `async`. An async facade method defers the plugin's
18
+ * body past a microtask boundary, and a `window.open` that lands after the user gesture has
19
+ * finished being handled is eaten by the popup blocker. The same rule binds every plugin's own
20
+ * `begin` and `logout`, and it is why a precondition must be synchronous too.
20
21
  */
21
22
  export declare const makeLoginService: (alias?: string) => LoginService;
22
23
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/login/service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAIlE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,EAA6B,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAE7F;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,gBAAgB,WAAW,MAAM,KAAmB,YAuDhE,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,QAAS,YAAY,CAAC,GAAG,CAAC,KAAG,YAQ3D,CAAA;AAED,4DAA4D;AAC5D,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,WAAW,EAAE,CAAC,SAAS,YAAY,CAAC,CAAC,CAAC,OACrE,CAAC,KACL,CAAC,GAAG,kBAMN,CAAA;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/login/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAK1F,OAAO,EAAmC,YAAY,EAAE,MAAM,aAAa,CAAA;AAK3E,OAAO,KAAK,EAE0B,YAAY,EAAE,kBAAkB,EACrE,MAAM,YAAY,CAAA;AAInB;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,gBAAgB,WAAW,MAAM,KAAmB,YAgNhE,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,QAAS,YAAY,CAAC,GAAG,CAAC,KAAG,YAQ3D,CAAA;AAED,4DAA4D;AAC5D,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,WAAW,EAAE,CAAC,SAAS,YAAY,CAAC,CAAC,CAAC,OACrE,CAAC,KACL,CAAC,GAAG,kBAMN,CAAA;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}