@securitydept/session-context-client 0.3.0-beta.1 → 0.3.0-beta.11

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.
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/web/index.ts"],"sourcesContent":["// Session Context Client — Browser Adapter\n//\n// Canonical import path:\n// import { loginWithRedirect } from \"@securitydept/session-context-client/web\"\n//\n// Provides browser-specific convenience helpers that trigger full-page\n// navigation (redirect) for session-based authentication. The root\n// `SessionContextClient` stays host-neutral; this subpath owns the\n// browser side-effect layer.\n//\n// Stability: provisional\n\nimport type { SessionContextClient } from \"../client\";\n\n/**\n * Options for {@link loginWithRedirect}.\n */\nexport interface LoginWithRedirectOptions {\n\t/**\n\t * Where to redirect the user after successful authentication.\n\t *\n\t * When omitted, `window.location.href` is used as the return URI and\n\t * persisted via the client's pending-login-redirect store for post-auth\n\t * consumption.\n\t */\n\tpostAuthRedirectUri?: string;\n}\n\n/**\n * One-shot browser redirect to the session login endpoint.\n *\n * 1. Saves the post-auth redirect intent into the client's pending store\n * (when a session store is configured).\n * 2. Navigates the current window to the login URL.\n *\n * This is the recommended browser entry point for initiating session-based\n * login. It is intentionally a standalone function (not a method on\n * `SessionContextClient`) to keep browser-specific side-effects out of the\n * host-neutral client contract.\n */\nexport async function loginWithRedirect(\n\tclient: SessionContextClient,\n\toptions: LoginWithRedirectOptions = {},\n): Promise<void> {\n\tconst postAuthRedirectUri =\n\t\toptions.postAuthRedirectUri ?? window.location.href;\n\n\tawait client.savePendingLoginRedirect(postAuthRedirectUri);\n\n\twindow.location.href = client.loginUrl(postAuthRedirectUri);\n}\n"],"mappings":";;;;;;;;;;;;;AAwCA,eAAsB,kBACrB,QACA,UAAoC,EAAE,EACtB;CAChB,MAAM,sBACL,QAAQ,uBAAuB,OAAO,SAAS;AAEhD,OAAM,OAAO,yBAAyB,oBAAoB;AAE1D,QAAO,SAAS,OAAO,OAAO,SAAS,oBAAoB"}