@proveanything/smartlinks 1.0.48 → 1.0.50

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/API_SUMMARY.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.0.48 | Generated: 2025-11-23T09:24:29.106Z
3
+ Version: 1.0.50 | Generated: 2025-11-23T11:52:15.257Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -164,9 +164,21 @@ interface AuthKitUser {
164
164
  **AuthLoginResponse** (interface)
165
165
  ```typescript
166
166
  interface AuthLoginResponse {
167
- token: string
167
+ token?: string
168
168
  user: AuthKitUser
169
169
  accountData?: Record<string, any>
170
+ emailVerificationMode?: 'immediate' | 'verify-auto-login' | 'verify-manual-login'
171
+ requiresEmailVerification?: boolean // True if email verification is required but not yet completed
172
+ emailVerificationDeadline?: number // Unix timestamp - for 'immediate' mode grace period deadline
173
+ accountLocked?: boolean // True if account is locked due to expired verification deadline
174
+ }
175
+ ```
176
+
177
+ **MagicLinkSendResponse** (interface)
178
+ ```typescript
179
+ interface MagicLinkSendResponse {
180
+ success: boolean
181
+ message: string
170
182
  }
171
183
  ```
172
184
 
@@ -227,6 +239,8 @@ interface EmailVerifyTokenResponse {
227
239
  message: string
228
240
  token?: string
229
241
  user?: AuthKitUser
242
+ accountData?: Record<string, any>
243
+ emailVerificationMode?: 'immediate' | 'verify-auto-login' | 'verify-manual-login'
230
244
  }
231
245
  ```
232
246
 
@@ -778,10 +792,16 @@ Register a new user (public).
778
792
  **googleLogin**(clientId: string, idToken: string) → `Promise<AuthLoginResponse>`
779
793
  Google OAuth login (public).
780
794
 
795
+ **sendMagicLink**(clientId: string, data: { email: string; redirectUrl: string; accountData?: Record<string, any> }) → `Promise<MagicLinkSendResponse>`
796
+ Send a magic link email to the user (public).
797
+
798
+ **verifyMagicLink**(clientId: string, token: string) → `Promise<MagicLinkVerifyResponse>`
799
+ Verify a magic link token and authenticate/create the user (public).
800
+
781
801
  **sendPhoneCode**(clientId: string, phoneNumber: string) → `Promise<PhoneSendCodeResponse>`
782
802
  Send phone verification code (public).
783
803
 
784
- **verifyPhoneCode**(clientId: string, verificationId: string, code: string) → `Promise<PhoneVerifyResponse>`
804
+ **verifyPhoneCode**(clientId: string, phoneNumber: string, code: string) → `Promise<PhoneVerifyResponse>`
785
805
  Verify phone verification code (public).
786
806
 
787
807
  **requestPasswordReset**(clientId: string, data: { email: string; redirectUrl?: string; clientName?: string }) → `Promise<PasswordResetRequestResponse>`
@@ -1,4 +1,4 @@
1
- import type { AuthLoginResponse, PhoneSendCodeResponse, PhoneVerifyResponse, PasswordResetRequestResponse, VerifyResetTokenResponse, PasswordResetCompleteResponse, EmailVerificationActionResponse, EmailVerifyTokenResponse, AuthKitConfig } from "../types/authKit";
1
+ import type { AuthLoginResponse, PhoneSendCodeResponse, PhoneVerifyResponse, PasswordResetRequestResponse, VerifyResetTokenResponse, PasswordResetCompleteResponse, EmailVerificationActionResponse, EmailVerifyTokenResponse, AuthKitConfig, MagicLinkSendResponse, MagicLinkVerifyResponse } from "../types/authKit";
2
2
  /**
3
3
  * Namespace containing helper functions for the new AuthKit API.
4
4
  * Legacy collection-based authKit helpers retained (marked as *Legacy*).
@@ -15,10 +15,18 @@ export declare namespace authKit {
15
15
  }): Promise<AuthLoginResponse>;
16
16
  /** Google OAuth login (public). */
17
17
  function googleLogin(clientId: string, idToken: string): Promise<AuthLoginResponse>;
18
+ /** Send a magic link email to the user (public). */
19
+ function sendMagicLink(clientId: string, data: {
20
+ email: string;
21
+ redirectUrl: string;
22
+ accountData?: Record<string, any>;
23
+ }): Promise<MagicLinkSendResponse>;
24
+ /** Verify a magic link token and authenticate/create the user (public). */
25
+ function verifyMagicLink(clientId: string, token: string): Promise<MagicLinkVerifyResponse>;
18
26
  /** Send phone verification code (public). */
19
27
  function sendPhoneCode(clientId: string, phoneNumber: string): Promise<PhoneSendCodeResponse>;
20
28
  /** Verify phone verification code (public). */
21
- function verifyPhoneCode(clientId: string, verificationId: string, code: string): Promise<PhoneVerifyResponse>;
29
+ function verifyPhoneCode(clientId: string, phoneNumber: string, code: string): Promise<PhoneVerifyResponse>;
22
30
  function requestPasswordReset(clientId: string, data: {
23
31
  email: string;
24
32
  redirectUrl?: string;
@@ -1,4 +1,4 @@
1
- import { request, post, put, del } from "../http";
1
+ import { request, post, put, del, setBearerToken } from "../http";
2
2
  /**
3
3
  * Namespace containing helper functions for the new AuthKit API.
4
4
  * Legacy collection-based authKit helpers retained (marked as *Legacy*).
@@ -23,14 +23,27 @@ export var authKit;
23
23
  return post(`/authkit/${encodeURIComponent(clientId)}/auth/google`, { idToken });
24
24
  }
25
25
  authKit.googleLogin = googleLogin;
26
+ /** Send a magic link email to the user (public). */
27
+ async function sendMagicLink(clientId, data) {
28
+ return post(`/authkit/${encodeURIComponent(clientId)}/magic-link/send`, data);
29
+ }
30
+ authKit.sendMagicLink = sendMagicLink;
31
+ /** Verify a magic link token and authenticate/create the user (public). */
32
+ async function verifyMagicLink(clientId, token) {
33
+ const res = await post(`/authkit/${encodeURIComponent(clientId)}/magic-link/verify`, { token });
34
+ if (res.token)
35
+ setBearerToken(res.token);
36
+ return res;
37
+ }
38
+ authKit.verifyMagicLink = verifyMagicLink;
26
39
  /** Send phone verification code (public). */
27
40
  async function sendPhoneCode(clientId, phoneNumber) {
28
41
  return post(`/authkit/${encodeURIComponent(clientId)}/auth/phone/send-code`, { phoneNumber });
29
42
  }
30
43
  authKit.sendPhoneCode = sendPhoneCode;
31
44
  /** Verify phone verification code (public). */
32
- async function verifyPhoneCode(clientId, verificationId, code) {
33
- return post(`/authkit/${encodeURIComponent(clientId)}/auth/phone/verify`, { verificationId, code });
45
+ async function verifyPhoneCode(clientId, phoneNumber, code) {
46
+ return post(`/authkit/${encodeURIComponent(clientId)}/auth/phone/verify`, { phoneNumber, code });
34
47
  }
35
48
  authKit.verifyPhoneCode = verifyPhoneCode;
36
49
  /* ===================================
@@ -8,9 +8,19 @@ export interface AuthKitUser {
8
8
  accountData?: Record<string, any>;
9
9
  }
10
10
  export interface AuthLoginResponse {
11
- token: string;
11
+ token?: string;
12
12
  user: AuthKitUser;
13
13
  accountData?: Record<string, any>;
14
+ emailVerificationMode?: 'immediate' | 'verify-auto-login' | 'verify-manual-login';
15
+ requiresEmailVerification?: boolean;
16
+ emailVerificationDeadline?: number;
17
+ accountLocked?: boolean;
18
+ }
19
+ export interface MagicLinkSendResponse {
20
+ success: boolean;
21
+ message: string;
22
+ }
23
+ export interface MagicLinkVerifyResponse extends AuthLoginResponse {
14
24
  }
15
25
  export interface PhoneSendCodeResponse {
16
26
  verificationId: string;
@@ -43,6 +53,8 @@ export interface EmailVerifyTokenResponse {
43
53
  message: string;
44
54
  token?: string;
45
55
  user?: AuthKitUser;
56
+ accountData?: Record<string, any>;
57
+ emailVerificationMode?: 'immediate' | 'verify-auto-login' | 'verify-manual-login';
46
58
  }
47
59
  export interface AuthKitBrandingConfig {
48
60
  logoUrl?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "1.0.48",
3
+ "version": "1.0.50",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",