zitejs 0.9.79 → 0.9.81

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.
@@ -247,6 +247,25 @@ export declare function loginWithRedirect(opts?: {
247
247
  export declare function logout(opts?: {
248
248
  returnTo?: string;
249
249
  }): void;
250
+ export declare function updateProfile(data: {
251
+ name?: string;
252
+ firstName?: string;
253
+ lastName?: string;
254
+ image?: string;
255
+ }): Promise<{
256
+ data: {
257
+ status: boolean;
258
+ };
259
+ error: null;
260
+ } | {
261
+ data: null;
262
+ error: {
263
+ code?: string | undefined | undefined;
264
+ message?: string | undefined | undefined;
265
+ status: number;
266
+ statusText: string;
267
+ };
268
+ }>;
250
269
  export type User = {
251
270
  id: string;
252
271
  name: string;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.signUp = exports.signOut = exports.signIn = exports.useSession = void 0;
4
4
  exports.loginWithRedirect = loginWithRedirect;
5
5
  exports.logout = logout;
6
+ exports.updateProfile = updateProfile;
6
7
  const react_1 = require("better-auth/react");
7
8
  const plugins_1 = require("better-auth/client/plugins");
8
9
  const authClient = (0, react_1.createAuthClient)({
@@ -11,6 +12,8 @@ const authClient = (0, react_1.createAuthClient)({
11
12
  });
12
13
  exports.useSession = authClient.useSession, exports.signIn = authClient.signIn, exports.signOut = authClient.signOut, exports.signUp = authClient.signUp;
13
14
  function loginWithRedirect(opts) {
15
+ if (window.location.pathname.startsWith('/auth/'))
16
+ return;
14
17
  const params = new URLSearchParams();
15
18
  if (opts?.redirectUrl)
16
19
  params.set('redirectUrl', opts.redirectUrl);
@@ -24,3 +27,6 @@ function logout(opts) {
24
27
  window.location.href = opts?.returnTo || '/';
25
28
  });
26
29
  }
30
+ function updateProfile(data) {
31
+ return authClient.updateUser(data);
32
+ }
@@ -503,6 +503,7 @@ function generateAuthWrapperTs() {
503
503
  " signUp,",
504
504
  " loginWithRedirect,",
505
505
  " logout,",
506
+ " updateProfile,",
506
507
  "} from 'zitejs/auth/base';",
507
508
  "",
508
509
  "export type {",
@@ -247,6 +247,25 @@ export declare function loginWithRedirect(opts?: {
247
247
  export declare function logout(opts?: {
248
248
  returnTo?: string;
249
249
  }): void;
250
+ export declare function updateProfile(data: {
251
+ name?: string;
252
+ firstName?: string;
253
+ lastName?: string;
254
+ image?: string;
255
+ }): Promise<{
256
+ data: {
257
+ status: boolean;
258
+ };
259
+ error: null;
260
+ } | {
261
+ data: null;
262
+ error: {
263
+ code?: string | undefined | undefined;
264
+ message?: string | undefined | undefined;
265
+ status: number;
266
+ statusText: string;
267
+ };
268
+ }>;
250
269
  export type User = {
251
270
  id: string;
252
271
  name: string;
@@ -6,6 +6,8 @@ const authClient = createAuthClient({
6
6
  });
7
7
  export const { useSession, signIn, signOut, signUp } = authClient;
8
8
  export function loginWithRedirect(opts) {
9
+ if (window.location.pathname.startsWith('/auth/'))
10
+ return;
9
11
  const params = new URLSearchParams();
10
12
  if (opts?.redirectUrl)
11
13
  params.set('redirectUrl', opts.redirectUrl);
@@ -19,3 +21,6 @@ export function logout(opts) {
19
21
  window.location.href = opts?.returnTo || '/';
20
22
  });
21
23
  }
24
+ export function updateProfile(data) {
25
+ return authClient.updateUser(data);
26
+ }
@@ -491,6 +491,7 @@ export function generateAuthWrapperTs() {
491
491
  " signUp,",
492
492
  " loginWithRedirect,",
493
493
  " logout,",
494
+ " updateProfile,",
494
495
  "} from 'zitejs/auth/base';",
495
496
  "",
496
497
  "export type {",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zitejs",
3
- "version": "0.9.79",
3
+ "version": "0.9.81",
4
4
  "description": "The Zite framework — build apps on Zite Database",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",