azirid-react 0.13.2 → 0.14.1

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.
package/README.md CHANGED
@@ -23,79 +23,42 @@ npm install react react-dom @tanstack/react-query
23
23
 
24
24
  ---
25
25
 
26
- ## Architecture: Proxy vs Direct Mode
26
+ ## Quick Start Next.js
27
27
 
28
- `azirid-react` supports two connection modes to the Azirid API. Choose the one that fits your stack:
29
-
30
- | | Proxy mode | Direct mode |
31
- | ---------------- | --------------------------------------------- | ----------------------------- |
32
- | **Best for** | Next.js (App Router) | React SPA (Vite, CRA, Remix) |
33
- | **Security** | First-party cookies, no CORS | Requires CORS on API |
34
- | **Setup** | Route handler + Provider | Provider only |
35
- | **How it works** | Browser → your app `/api/auth/*` → Azirid API | Browser → Azirid API directly |
36
-
37
- ### Proxy mode (recommended for Next.js)
38
-
39
- Requests go to your Next.js app's `/api/auth/*` route handler, which securely proxies them to the Azirid API. Cookies are first-party (same domain), so no CORS configuration is needed.
40
-
41
- ```tsx
42
- // No apiUrl prop → proxy mode is activated automatically
43
- <AziridProvider publishableKey="pk_live_...">
44
- ```
45
-
46
- ### Direct mode (for React SPA / Vite)
47
-
48
- Requests go directly to the Azirid API. Requires CORS to be configured on the API server.
49
-
50
- ```tsx
51
- // apiUrl prop → direct mode
52
- <AziridProvider apiUrl="https://api.azirid.com" publishableKey="pk_live_...">
53
- ```
54
-
55
- ---
56
-
57
- ## Quick Start — Next.js (Proxy Mode)
58
-
59
- ### 1. Create the route handler
60
-
61
- ```ts
62
- // app/api/auth/[...path]/route.ts
63
- export { GET, POST, PUT, PATCH, DELETE } from 'azirid-react/next/handlers'
64
- ```
65
-
66
- That's it. The SDK handles proxy logic, cookie fixing, and header forwarding internally. Works with Next.js 14, 15, and 16+ automatically — including `output: 'standalone'` builds.
67
-
68
- ### 2. Set the API URL (optional)
69
-
70
- ```env
71
- # .env (server-side only — never exposed to the browser)
72
- # Default: https://api.azirid.com
73
- # For local development with the API running locally:
74
- AZIRID_API_URL=http://localhost:3000
75
- ```
76
-
77
- ### 3. Wrap your app with `<AziridProvider>`
28
+ ### 1. Wrap your app with `<AziridProvider>`
78
29
 
79
30
  ```tsx
80
31
  // app/layout.tsx
81
32
  import { AziridProvider } from 'azirid-react'
82
33
 
83
34
  export default function RootLayout({ children }: { children: React.ReactNode }) {
84
- const router = useRouter()
85
-
86
35
  return (
87
- <AziridProvider
88
- publishableKey={process.env.NEXT_PUBLIC_AZIRID_PK!}
89
- onAuthStateChange={() => router.refresh()}
90
- onSessionExpired={() => (window.location.href = '/login')}
91
- >
36
+ <AziridProvider publishableKey={process.env.NEXT_PUBLIC_AZIRID_PK!}>
92
37
  {children}
93
38
  </AziridProvider>
94
39
  )
95
40
  }
96
41
  ```
97
42
 
98
- ### 4. Add the login page
43
+ ### 2. Add route protection (optional)
44
+
45
+ ```ts
46
+ // proxy.ts (Next.js 16+)
47
+ import { createAziridProxy } from 'azirid-react/next/proxy'
48
+
49
+ export const proxy = createAziridProxy({
50
+ protectedRoutes: ['/dashboard'],
51
+ loginUrl: '/login',
52
+ })
53
+
54
+ export const config = {
55
+ matcher: ['/((?!_next|favicon.ico|api/).*)'],
56
+ }
57
+ ```
58
+
59
+ The middleware validates JWTs using JWKS and protects routes automatically.
60
+
61
+ ### 3. Add the login page
99
62
 
100
63
  ```tsx
101
64
  // app/login/page.tsx
@@ -106,22 +69,25 @@ export default function LoginPage() {
106
69
  }
107
70
  ```
108
71
 
72
+ ### 4. Configure your environment
73
+
74
+ ```env
75
+ # .env
76
+ NEXT_PUBLIC_AZIRID_PK=pk_live_...
77
+ ```
78
+
109
79
  ---
110
80
 
111
- ## Quick Start — React SPA (Direct Mode)
81
+ ## Quick Start — React SPA (Vite)
112
82
 
113
83
  ### 1. Wrap your app with `<AziridProvider>`
114
84
 
115
85
  ```tsx
116
- // main.tsx (Vite / CRA)
86
+ // main.tsx
117
87
  import { AziridProvider } from 'azirid-react'
118
88
 
119
89
  createRoot(document.getElementById('root')!).render(
120
- <AziridProvider
121
- apiUrl={import.meta.env.VITE_AZIRID_API_URL || 'https://api.azirid.com'}
122
- publishableKey={import.meta.env.VITE_AZIRID_PK}
123
- onLoginSuccess={(data) => console.log('Logged in:', data.user)}
124
- >
90
+ <AziridProvider publishableKey={import.meta.env.VITE_AZIRID_PK}>
125
91
  <App />
126
92
  </AziridProvider>,
127
93
  )
@@ -130,8 +96,6 @@ createRoot(document.getElementById('root')!).render(
130
96
  ### 2. Configure your environment
131
97
 
132
98
  ```env
133
- # .env
134
- VITE_AZIRID_API_URL=https://api.azirid.com
135
99
  VITE_AZIRID_PK=pk_live_...
136
100
  ```
137
101
 
@@ -145,8 +109,6 @@ export default function LoginPage() {
145
109
  }
146
110
  ```
147
111
 
148
- No route handler or proxy needed — requests go directly to the API.
149
-
150
112
  ---
151
113
 
152
114
  ## Components
@@ -1293,14 +1255,13 @@ The badge renders automatically below each built-in form component (`LoginForm`,
1293
1255
  Under the hood `AziridProvider` creates an `AccessClient` via `createAccessClient`. You can also create a client directly to make raw API calls.
1294
1256
 
1295
1257
  ```ts
1296
- import { createAccessClient, BASE_PATHS } from 'azirid-react'
1258
+ import { createAccessClient, AUTH_BASE_PATH } from 'azirid-react'
1297
1259
  import type { AccessClientConfig } from 'azirid-react'
1298
1260
 
1299
- // Direct mode — point to the API
1300
1261
  const client = createAccessClient(
1301
1262
  {
1302
1263
  baseUrl: 'https://api.azirid.com',
1303
- basePath: BASE_PATHS.direct, // '/v1/users/auth'
1264
+ basePath: AUTH_BASE_PATH, // '/v1/users/auth'
1304
1265
  },
1305
1266
  { publishableKey: 'pk_live_...' },
1306
1267
  )
@@ -1335,14 +1296,12 @@ function createAccessClient(
1335
1296
  | Prop | Type | Default | Description |
1336
1297
  | ------------------ | ------------------------- | ------- | -------------------------------------------------------------------------------- |
1337
1298
  | `children` | `ReactNode` | — | **Required.** Your app tree |
1338
- | `apiUrl` | `string` | — | API URL for direct mode. Omit for proxy mode (recommended in Next.js) |
1339
1299
  | `publishableKey` | `string` | — | Publishable key (e.g. `pk_live_...`) |
1340
1300
  | `tenantId` | `string` | — | Tenant ID for multi-tenant apps |
1341
1301
  | `fetchOptions` | `Record<string, string>` | — | Extra headers to send with every request |
1342
1302
  | `autoBootstrap` | `boolean` | `true` | Auto-restore session on mount. Runs once (safe in React 18 Strict Mode) |
1343
1303
  | `refreshInterval` | `number` | `50000` | Token refresh interval in ms. `0` to disable |
1344
- | `sessionSyncUrl` | `string \| false` | auto | URL for session cookie sync. Auto-activates in dev mode. Pass `false` to disable |
1345
- | `onAuthStateChange`| `() => void` | — | Called after login, signup, or logout. **In Next.js, pass `router.refresh()`** to sync server actions with updated cookies |
1304
+ | `onAuthStateChange`| `() => void` | | Called after login, signup, or logout |
1346
1305
  | `onLoginSuccess` | `(data) => void` | — | Called after successful login |
1347
1306
  | `onSignupSuccess` | `(data) => void` | — | Called after successful signup |
1348
1307
  | `onLogoutSuccess` | `() => void` | — | Called after logout |
@@ -1454,78 +1413,14 @@ export function Providers({ children }: { children: React.ReactNode }) {
1454
1413
 
1455
1414
  > **Not using server actions?** (e.g. pure client-side SPA with Vite) — you can skip `onAuthStateChange`.
1456
1415
 
1457
- ### Proxy Route Handler (all versions)
1416
+ ### Middleware Route Protection & JWT Validation
1458
1417
 
1459
- Create the file `app/api/auth/[...path]/route.ts` one line is all you need:
1460
-
1461
- ```ts
1462
- // app/api/auth/[...path]/route.ts
1463
- export { GET, POST, PUT, PATCH, DELETE } from 'azirid-react/next/handlers'
1464
- ```
1465
-
1466
- That's it. The SDK handles all the proxy logic, cookie fixing, and header forwarding internally.
1467
- It works with Next.js 14, 15, and 16+ automatically — including `output: 'standalone'` builds.
1468
-
1469
- ### Custom API URL or debug logging
1470
-
1471
- ```ts
1472
- // app/api/auth/[...path]/route.ts
1473
- import { createAziridRouteHandlers } from 'azirid-react/next/handlers'
1474
-
1475
- export const { GET, POST, PUT, PATCH, DELETE } = createAziridRouteHandlers({
1476
- apiUrl: 'https://my-custom-api.com',
1477
- debug: true, // logs proxy requests to console
1478
- })
1479
- ```
1480
-
1481
- ### Environment variable
1482
-
1483
- The proxy reads `AZIRID_API_URL` (server-side only) to know where to forward requests:
1484
-
1485
- ```env
1486
- # .env
1487
- # Default: https://api.azirid.com
1488
- # For local development:
1489
- AZIRID_API_URL=http://localhost:3000
1490
- ```
1491
-
1492
- > **Important:** Use `AZIRID_API_URL` (without `NEXT_PUBLIC_` prefix) — the API URL should never be exposed to the browser. The proxy runs server-side only.
1493
-
1494
- ### Next.js Config
1495
-
1496
- #### Next.js 16+ (`next.config.ts`)
1497
-
1498
- Turbopack is the default bundler — `transpilePackages` is no longer needed:
1499
-
1500
- ```ts
1501
- // next.config.ts
1502
- import type { NextConfig } from 'next'
1503
-
1504
- const nextConfig: NextConfig = {}
1505
-
1506
- export default nextConfig
1507
- ```
1508
-
1509
- #### Next.js 14/15 (`next.config.js`)
1510
-
1511
- ```js
1512
- // next.config.js
1513
- const { withAziridProxy } = require('azirid-react/next')
1514
-
1515
- /** @type {import('next').NextConfig} */
1516
- module.exports = withAziridProxy()({
1517
- transpilePackages: ['azirid-react'],
1518
- })
1519
- ```
1520
-
1521
- ### Route Protection (optional)
1522
-
1523
- > **Not required for basic usage.** Only add this if you need to protect specific routes from unauthenticated users.
1418
+ The middleware validates `__session` JWT cookies using JWKS (RS256) and protects routes.
1524
1419
 
1525
1420
  #### Next.js 16+ (`proxy.ts`)
1526
1421
 
1527
1422
  ```ts
1528
- // proxy.ts — only needed if you want route protection
1423
+ // proxy.ts
1529
1424
  import { createAziridProxy } from 'azirid-react/next/proxy'
1530
1425
 
1531
1426
  export const proxy = createAziridProxy({
@@ -1539,28 +1434,19 @@ export const config = {
1539
1434
  }
1540
1435
  ```
1541
1436
 
1542
- #### Next.js 14/15 (`middleware.ts`)
1543
-
1544
- ```ts
1545
- // middleware.ts only needed if you want route protection
1546
- import { createAziridMiddleware } from 'azirid-react/next/proxy'
1547
-
1548
- export default createAziridMiddleware({
1549
- protectedRoutes: ['/dashboard', '/settings'],
1550
- loginUrl: '/login',
1551
- publicRoutes: ['/login', '/signup', '/forgot-password'],
1552
- })
1553
-
1554
- export const config = {
1555
- matcher: ['/((?!_next|favicon.ico|api/).*)'],
1556
- }
1557
- ```
1437
+ | Option | Type | Default | Description |
1438
+ | ------------------ | ---------- | ------------- | ------------------------------------------------ |
1439
+ | `cookieName` | `string` | `"__session"` | Cookie carrying the access token JWT |
1440
+ | `protectedRoutes` | `string[]` | — | Routes that require authentication |
1441
+ | `loginUrl` | `string` | `"/login"` | Redirect target for unauthenticated users |
1442
+ | `publicRoutes` | `string[]` | login/signup | Always-accessible routes |
1443
+ | `jwksUrl` | `string` | auto | Override JWKS endpoint URL |
1558
1444
 
1559
1445
  ---
1560
1446
 
1561
1447
  ## Server-side (Next.js App Router)
1562
1448
 
1563
- For **Server Components**, **Server Actions**, and **Route Handlers**, use the `azirid-react/server` entry point to read the session token from the httpOnly `__session` cookie.
1449
+ For **Server Components**, **Server Actions**, and **Route Handlers**, use the `azirid-react/server` entry point to read the session token from the `__session` cookie.
1564
1450
 
1565
1451
  ### Setup
1566
1452
 
@@ -1586,7 +1472,7 @@ export async function getProfile() {
1586
1472
  const token = await getSessionToken()
1587
1473
  if (!token) throw new Error('Not authenticated')
1588
1474
 
1589
- const res = await fetch(`${process.env.AZIRID_API_URL}/v1/users/auth/me`, {
1475
+ const res = await fetch('https://api.azirid.com/v1/users/auth/me', {
1590
1476
  headers: { Authorization: `Bearer ${token}` },
1591
1477
  })
1592
1478
  return res.json()
@@ -1604,7 +1490,7 @@ export default async function DashboardPage() {
1604
1490
  const token = await getSessionToken()
1605
1491
  if (!token) redirect('/login')
1606
1492
 
1607
- const res = await fetch(`${process.env.AZIRID_API_URL}/v1/users/auth/me`, {
1493
+ const res = await fetch('https://api.azirid.com/v1/users/auth/me', {
1608
1494
  headers: { Authorization: `Bearer ${token}` },
1609
1495
  })
1610
1496
  const user = await res.json()
@@ -1615,36 +1501,9 @@ export default async function DashboardPage() {
1615
1501
 
1616
1502
  ### Options
1617
1503
 
1618
- | Option | Type | Default | Description |
1619
- | ------------ | -------- | ------------- | ------------------------------------------ |
1620
- | `cookieName` | `string` | `"__session"` | Name of the httpOnly cookie with the token |
1621
-
1622
- ### `createSessionSyncHandler`
1623
-
1624
- Creates a route handler that syncs the access token to a local httpOnly cookie. Useful for cross-origin development setups where the API is on a different domain.
1625
-
1626
- ```ts
1627
- // app/api/auth/session/route.ts
1628
- import { createSessionSyncHandler } from 'azirid-react/server'
1629
-
1630
- export const { POST, DELETE } = createSessionSyncHandler()
1631
- ```
1632
-
1633
- With custom options:
1634
-
1635
- ```ts
1636
- export const { POST, DELETE } = createSessionSyncHandler({
1637
- cookieName: '__session', // default
1638
- secure: true, // set Secure flag on cookie
1639
- maxAge: 3600, // cookie max age in seconds (default: 1h)
1640
- })
1641
- ```
1642
-
1643
- | Option | Type | Default | Description |
1644
- | ------------ | --------- | ------------- | ----------------------------------- |
1645
- | `cookieName` | `string` | `"__session"` | Name of the httpOnly cookie |
1646
- | `secure` | `boolean` | `false` | Set the `Secure` flag on the cookie |
1647
- | `maxAge` | `number` | `3600` | Cookie max age in seconds |
1504
+ | Option | Type | Default | Description |
1505
+ | ------------ | -------- | ------------- | ------------------------------------ |
1506
+ | `cookieName` | `string` | `"__session"` | Name of the cookie with the token |
1648
1507
 
1649
1508
  ---
1650
1509
 
@@ -1741,13 +1600,12 @@ const { mutate, isPending } = useUpdateProfile({
1741
1600
  })
1742
1601
  ```
1743
1602
 
1744
- ### `BASE_PATHS` and `buildPaths`
1603
+ ### `AUTH_BASE_PATH` and `buildPaths`
1745
1604
 
1746
1605
  ```tsx
1747
- import { BASE_PATHS, buildPaths } from 'azirid-react'
1606
+ import { AUTH_BASE_PATH, buildPaths } from 'azirid-react'
1748
1607
 
1749
- BASE_PATHS.proxy // '/api/auth'
1750
- BASE_PATHS.direct // '/v1/users/auth'
1608
+ AUTH_BASE_PATH // '/v1/users/auth'
1751
1609
 
1752
1610
  // Build custom path map from a base path
1753
1611
  const paths = buildPaths('/custom/auth')
package/dist/index.cjs CHANGED
@@ -131,19 +131,14 @@ var SUFFIXES = {
131
131
  branches: "branches",
132
132
  paymentMethods: "payment-methods"
133
133
  };
134
- var BASE_PATHS = {
135
- /** Proxy mode (Next.js): requests go to the same origin via route handler */
136
- proxy: "/api/auth",
137
- /** Direct mode: requests go straight to the Azirid API */
138
- direct: "/v1/users/auth"
139
- };
134
+ var AUTH_BASE_PATH = "/v1/users/auth";
140
135
  function buildPaths(basePath) {
141
136
  const bp = basePath.replace(/\/$/, "");
142
137
  return Object.fromEntries(
143
138
  Object.entries(SUFFIXES).map(([key, suffix]) => [key, `${bp}/${suffix}`])
144
139
  );
145
140
  }
146
- var PATHS = buildPaths(BASE_PATHS.direct);
141
+ var PATHS = buildPaths(AUTH_BASE_PATH);
147
142
  function createAccessClient(config, appContext) {
148
143
  const baseUrl = config.baseUrl.replace(/\/$/, "");
149
144
  const paths = config.basePath ? buildPaths(config.basePath) : PATHS;
@@ -210,6 +205,13 @@ function createAccessClient(config, appContext) {
210
205
  }
211
206
  function setAccessToken(token) {
212
207
  accessToken = token;
208
+ if (typeof document !== "undefined") {
209
+ if (token) {
210
+ document.cookie = `__session=${token}; Path=/; SameSite=Lax; Max-Age=900`;
211
+ } else {
212
+ document.cookie = "__session=; Path=/; SameSite=Lax; Max-Age=0";
213
+ }
214
+ }
213
215
  }
214
216
  function getAccessToken() {
215
217
  return accessToken;
@@ -776,40 +778,12 @@ function AziridProviderInner({
776
778
  [props.locale, props.messages]
777
779
  );
778
780
  const brandingValue = react.useMemo(() => ({ branding, messages }), [branding, messages]);
779
- const isProxyMode = !props.apiUrl;
780
- const syncUrl = react.useMemo(() => {
781
- if (props.sessionSyncUrl === false) return null;
782
- if (props.sessionSyncUrl) return props.sessionSyncUrl;
783
- if (isProxyMode) return null;
784
- if (client.appContext?.publishableKey?.startsWith("pk_dev")) {
785
- return "/api/auth/session";
786
- }
787
- return null;
788
- }, [props.sessionSyncUrl, client.appContext?.publishableKey, isProxyMode]);
789
- const syncSession = react.useCallback(
790
- (token) => {
791
- if (!syncUrl) return;
792
- if (token) {
793
- fetch(syncUrl, {
794
- method: "POST",
795
- headers: { "Content-Type": "application/json" },
796
- body: JSON.stringify({ token })
797
- }).catch(() => {
798
- });
799
- } else {
800
- fetch(syncUrl, { method: "DELETE" }).catch(() => {
801
- });
802
- }
803
- },
804
- [syncUrl]
805
- );
806
781
  const updateAccessToken = react.useCallback(
807
782
  (token) => {
808
783
  setAccessToken(token);
809
784
  client.setAccessToken(token);
810
- syncSession(token);
811
785
  },
812
- [client, syncSession]
786
+ [client]
813
787
  );
814
788
  const saveSessionTokens = react.useCallback(
815
789
  (data) => {
@@ -1013,11 +987,9 @@ function AziridProvider(props) {
1013
987
  publishableKey: props.publishableKey,
1014
988
  tenantId: props.tenantId
1015
989
  } : void 0;
1016
- const isProxy = !props.apiUrl;
1017
- const baseUrl = isProxy ? "" : props.apiUrl.replace(/\/$/, "");
1018
- const basePath = isProxy ? BASE_PATHS.proxy : BASE_PATHS.direct;
990
+ const baseUrl = (props.apiUrl ?? "https://api.azirid.com").replace(/\/$/, "");
1019
991
  return createAccessClient(
1020
- { baseUrl, basePath, headers: props.fetchOptions },
992
+ { baseUrl, basePath: AUTH_BASE_PATH, headers: props.fetchOptions },
1021
993
  appContext
1022
994
  );
1023
995
  }, [props.publishableKey, props.tenantId, props.fetchOptions, props.apiUrl]);
@@ -4029,29 +4001,8 @@ function HandoffCallback({
4029
4001
  onError?.(new Error("No API URL in handoff link"));
4030
4002
  return;
4031
4003
  }
4032
- const exchangeUrl = `${apiUrl.replace(/\/+$/, "")}/users/auth/handoff/exchange`;
4033
- fetch(exchangeUrl, {
4034
- method: "POST",
4035
- headers: { "Content-Type": "application/json" },
4036
- credentials: "include",
4037
- body: JSON.stringify({ code })
4038
- }).then(async (res) => {
4039
- if (!res.ok) {
4040
- const body = await res.json().catch(() => null);
4041
- throw new Error(body?.error?.message ?? body?.message ?? "Handoff exchange failed");
4042
- }
4043
- return res.json();
4044
- }).then((raw) => {
4045
- const json = raw && typeof raw === "object" && "data" in raw && "meta" in raw ? raw.data : raw;
4046
- json.at ?? json.accessToken;
4047
- const refreshToken = json.rt ?? json.refreshToken;
4048
- const csrfToken = json.xc ?? json.csrfToken;
4049
- try {
4050
- if (refreshToken) sessionStorage.setItem("__azrt", refreshToken);
4051
- if (csrfToken) sessionStorage.setItem("__azxc", csrfToken);
4052
- } catch {
4053
- }
4054
- onSuccess?.(json.user);
4004
+ performHandoff(apiUrl, code).then((user) => {
4005
+ onSuccess?.(user);
4055
4006
  }).catch((err) => {
4056
4007
  setStatus("error");
4057
4008
  const error = err instanceof Error ? err : new Error("Handoff exchange failed");
@@ -4064,6 +4015,33 @@ function HandoffCallback({
4064
4015
  }
4065
4016
  return /* @__PURE__ */ jsxRuntime.jsx("div", { style: wrapperStyle, children: /* @__PURE__ */ jsxRuntime.jsx("p", { style: messageStyle2, children: loadingText }) });
4066
4017
  }
4018
+ async function performHandoff(apiUrl, code) {
4019
+ const exchangeUrl = `${apiUrl.replace(/\/+$/, "")}/users/auth/handoff/exchange`;
4020
+ const res = await fetch(exchangeUrl, {
4021
+ method: "POST",
4022
+ headers: { "Content-Type": "application/json" },
4023
+ credentials: "include",
4024
+ body: JSON.stringify({ code })
4025
+ });
4026
+ if (!res.ok) {
4027
+ const body = await res.json().catch(() => null);
4028
+ throw new Error(body?.error?.message ?? body?.message ?? "Handoff exchange failed");
4029
+ }
4030
+ const raw = await res.json();
4031
+ const json = raw && typeof raw === "object" && "data" in raw && "meta" in raw ? raw.data : raw;
4032
+ const refreshToken = json.rt ?? json.refreshToken;
4033
+ const csrfToken = json.xc ?? json.csrfToken;
4034
+ try {
4035
+ if (refreshToken) sessionStorage.setItem("__azrt", refreshToken);
4036
+ if (csrfToken) sessionStorage.setItem("__azxc", csrfToken);
4037
+ } catch {
4038
+ }
4039
+ const at = json.at ?? json.accessToken;
4040
+ if (at) {
4041
+ document.cookie = `__session=${at}; Path=/; SameSite=Lax; Max-Age=900`;
4042
+ }
4043
+ return json.user;
4044
+ }
4067
4045
  var wrapperStyle = {
4068
4046
  display: "flex",
4069
4047
  flexDirection: "column",
@@ -4875,11 +4853,11 @@ function usePasswordToggle() {
4875
4853
  }
4876
4854
 
4877
4855
  // src/index.ts
4878
- var SDK_VERSION = "0.13.2";
4856
+ var SDK_VERSION = "0.14.1";
4879
4857
 
4858
+ exports.AUTH_BASE_PATH = AUTH_BASE_PATH;
4880
4859
  exports.AuthForm = AuthForm;
4881
4860
  exports.AziridProvider = AziridProvider;
4882
- exports.BASE_PATHS = BASE_PATHS;
4883
4861
  exports.CheckoutButton = CheckoutButton;
4884
4862
  exports.ForgotPasswordForm = ForgotPasswordForm;
4885
4863
  exports.HandoffCallback = HandoffCallback;