@contentgrowth/content-auth 0.6.1 → 0.6.2

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,6 +1,6 @@
1
1
  import {
2
2
  authClient
3
- } from "./chunk-NKDKDBM2.js";
3
+ } from "./chunk-W5RBQBED.js";
4
4
 
5
5
  // src/frontend/components/react/AuthForm.tsx
6
6
  import { useState, useRef, useEffect } from "react";
@@ -1,12 +1,16 @@
1
1
  // src/frontend/client.ts
2
2
  import { createAuthClient } from "better-auth/react";
3
3
  import { organizationClient } from "better-auth/client/plugins";
4
- var createClient = (baseUrl) => {
4
+ var createClient = (baseUrl, options = {}) => {
5
+ const { refetchOnWindowFocus = false } = options;
5
6
  return createAuthClient({
6
7
  baseURL: baseUrl,
7
8
  plugins: [
8
9
  organizationClient()
9
- ]
10
+ ],
11
+ sessionOptions: {
12
+ refetchOnWindowFocus
13
+ }
10
14
  });
11
15
  };
12
16
  var authClient = createClient();
@@ -3,7 +3,21 @@ import * as _better_fetch_fetch from '@better-fetch/fetch';
3
3
  import * as better_auth from 'better-auth';
4
4
  import * as better_auth_plugins from 'better-auth/plugins';
5
5
 
6
- declare const createClient: (baseUrl?: string) => {
6
+ interface ContentAuthClientOptions {
7
+ /**
8
+ * Controls whether the session is re-fetched when the browser window
9
+ * regains focus (e.g. lock/unlock screen, switching apps in a PWA).
10
+ *
11
+ * Defaults to `false`. Re-fetching on focus causes a React re-render
12
+ * cascade that can interrupt active client-side sessions (e.g. vocabulary
13
+ * review flows) by triggering component remounts.
14
+ *
15
+ * Set to `true` only for apps that need the session to be always
16
+ * up-to-date immediately after the user returns to the tab.
17
+ */
18
+ refetchOnWindowFocus?: boolean;
19
+ }
20
+ declare const createClient: (baseUrl?: string, options?: ContentAuthClientOptions) => {
7
21
  useActiveOrganization: () => {
8
22
  data: better_auth.Prettify<{
9
23
  id: string;
@@ -3194,4 +3208,4 @@ declare const authClient: {
3194
3208
  };
3195
3209
  };
3196
3210
 
3197
- export { authClient, createClient };
3211
+ export { type ContentAuthClientOptions, authClient, createClient };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  authClient,
3
3
  createClient
4
- } from "../chunk-NKDKDBM2.js";
4
+ } from "../chunk-W5RBQBED.js";
5
5
  import "../chunk-R5U7XKVJ.js";
6
6
  export {
7
7
  authClient,
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { authClient } from './client.js';
3
- export { createClient } from './client.js';
3
+ export { ContentAuthClientOptions, createClient } from './client.js';
4
4
  import 'nanostores';
5
5
  import '@better-fetch/fetch';
6
6
  import 'better-auth';
@@ -7,11 +7,11 @@ import {
7
7
  PasswordChanger,
8
8
  ProfileEditor,
9
9
  ResetPasswordForm
10
- } from "../chunk-AHFGJJZD.js";
10
+ } from "../chunk-EDNWJGKD.js";
11
11
  import {
12
12
  authClient,
13
13
  createClient
14
- } from "../chunk-NKDKDBM2.js";
14
+ } from "../chunk-W5RBQBED.js";
15
15
  import "../chunk-R5U7XKVJ.js";
16
16
  export {
17
17
  AuthForm,
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { AuthConfig, EmailNormalizationConfig, FieldAttribute, SchemaMapping, SignInTrackingConfig, TableMapping, TurnstileConfig, authMiddleware, createAuth, createAuthApp, getInvitationLink, getSessionToken, isGmailAddress, normalizeEmail, schema, verifyTurnstile } from './backend/index.js';
2
2
  export { AuthForm, CreateOrganizationForm, ForgotPasswordForm, InviteMemberForm, OrganizationSwitcher, PasswordChanger, PasswordChangerProps, ProfileEditor, ProfileEditorProps, ResetPasswordForm } from './frontend/index.js';
3
- export { authClient, createClient } from './frontend/client.js';
3
+ export { ContentAuthClientOptions, authClient, createClient } from './frontend/client.js';
4
4
  export * from 'better-auth';
5
5
  export { Hono } from 'hono';
6
6
  import 'hono/types';
package/dist/index.js CHANGED
@@ -19,11 +19,11 @@ import {
19
19
  PasswordChanger,
20
20
  ProfileEditor,
21
21
  ResetPasswordForm
22
- } from "./chunk-AHFGJJZD.js";
22
+ } from "./chunk-EDNWJGKD.js";
23
23
  import {
24
24
  authClient,
25
25
  createClient
26
- } from "./chunk-NKDKDBM2.js";
26
+ } from "./chunk-W5RBQBED.js";
27
27
  import "./chunk-R5U7XKVJ.js";
28
28
  export {
29
29
  AuthForm,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentgrowth/content-auth",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Better Auth wrapper with UI components for Cloudflare Workers & Pages. Includes custom schema mapping, Turnstile bot protection, and email normalization.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",