@proveanything/smartlinks 1.14.4 → 1.14.5

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/dist/api/auth.js CHANGED
@@ -1,4 +1,4 @@
1
- import { post, request, setBearerToken, getApiHeaders, hasAuthCredentials, isProxyEnabled } from "../http";
1
+ import { post, request, setBearerToken, getApiHeaders, hasAuthCredentials, isProxyEnabled, invalidateCache } from "../http";
2
2
  import { SmartlinksApiError } from "../types/error";
3
3
  const DEFAULT_AUTH_LOCATION_CACHE_KEY = 'smartlinks.auth.location';
4
4
  const DEFAULT_AUTH_LOCATION_TTL_MS = 30 * 60 * 1000;
@@ -80,6 +80,7 @@ export var auth;
80
80
  async function login(email, password) {
81
81
  const res = await post("/public/auth/login", { email, password });
82
82
  setBearerToken(res.bearerToken);
83
+ invalidateCache();
83
84
  return res;
84
85
  }
85
86
  auth.login = login;
@@ -88,6 +89,7 @@ export var auth;
88
89
  */
89
90
  function logout() {
90
91
  setBearerToken(undefined);
92
+ invalidateCache();
91
93
  }
92
94
  auth.logout = logout;
93
95
  /**
@@ -103,6 +105,7 @@ export var auth;
103
105
  const result = await post("/public/auth/verify", {}, headers);
104
106
  if (token && result.valid) {
105
107
  setBearerToken(token);
108
+ invalidateCache();
106
109
  }
107
110
  return result;
108
111
  }
@@ -131,8 +134,10 @@ export var auth;
131
134
  async function registerUser(user) {
132
135
  // Use the provided token, or the one from getApiHeaders
133
136
  const res = await post("/public/auth/register", user);
134
- if (res.bearerToken)
137
+ if (res.bearerToken) {
135
138
  setBearerToken(res.bearerToken);
139
+ invalidateCache();
140
+ }
136
141
  return res;
137
142
  }
138
143
  auth.registerUser = registerUser;
@@ -1,4 +1,4 @@
1
- import { request, post, put, del, setBearerToken } from "../http";
1
+ import { request, post, put, del, setBearerToken, invalidateCache } 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*).
@@ -11,8 +11,10 @@ export var authKit;
11
11
  /** Login with email + password (public). */
12
12
  async function login(clientId, email, password) {
13
13
  const res = await post(`/authkit/${encodeURIComponent(clientId)}/auth/login`, { email, password });
14
- if (res.token)
14
+ if (res.token) {
15
15
  setBearerToken(res.token);
16
+ invalidateCache();
17
+ }
16
18
  return res;
17
19
  }
18
20
  authKit.login = login;
@@ -24,16 +26,20 @@ export var authKit;
24
26
  /** Google OAuth login via ID token (public). */
25
27
  async function googleLogin(clientId, idToken) {
26
28
  const res = await post(`/authkit/${encodeURIComponent(clientId)}/auth/google`, { idToken });
27
- if (res.token)
29
+ if (res.token) {
28
30
  setBearerToken(res.token);
31
+ invalidateCache();
32
+ }
29
33
  return res;
30
34
  }
31
35
  authKit.googleLogin = googleLogin;
32
36
  /** Google OAuth login via server-side authorization code (public). */
33
37
  async function googleCodeLogin(clientId, code, redirectUri) {
34
38
  const res = await post(`/authkit/${encodeURIComponent(clientId)}/auth/google-code`, { code, redirectUri });
35
- if (res.token)
39
+ if (res.token) {
36
40
  setBearerToken(res.token);
41
+ invalidateCache();
42
+ }
37
43
  return res;
38
44
  }
39
45
  authKit.googleCodeLogin = googleCodeLogin;
@@ -45,8 +51,10 @@ export var authKit;
45
51
  /** Verify a magic link token and authenticate/create the user (public). */
46
52
  async function verifyMagicLink(clientId, token) {
47
53
  const res = await post(`/authkit/${encodeURIComponent(clientId)}/auth/magic-link/verify`, { token });
48
- if (res.token)
54
+ if (res.token) {
49
55
  setBearerToken(res.token);
56
+ invalidateCache();
57
+ }
50
58
  return res;
51
59
  }
52
60
  authKit.verifyMagicLink = verifyMagicLink;
@@ -59,6 +67,7 @@ export var authKit;
59
67
  async function verifyPhoneCode(clientId, phoneNumber, code) {
60
68
  const res = await post(`/authkit/${encodeURIComponent(clientId)}/auth/phone/verify`, { phoneNumber, code });
61
69
  setBearerToken(res.token);
70
+ invalidateCache();
62
71
  return res;
63
72
  }
64
73
  authKit.verifyPhoneCode = verifyPhoneCode;
@@ -82,6 +91,7 @@ export var authKit;
82
91
  async function exchangeWhatsAppSession(clientId, token, sessionKey) {
83
92
  const res = await post(`/authkit/${encodeURIComponent(clientId)}/auth/whatsapp/exchange-session`, { token, sessionKey });
84
93
  setBearerToken(res.token);
94
+ invalidateCache();
85
95
  return res;
86
96
  }
87
97
  authKit.exchangeWhatsAppSession = exchangeWhatsAppSession;
@@ -143,8 +153,10 @@ export var authKit;
143
153
  /** Update the authenticated user's profile and replace the bearer token when refreshed claims are returned. */
144
154
  async function updateProfile(clientId, data) {
145
155
  const res = await post(`/authkit/${encodeURIComponent(clientId)}/account/update-profile`, data);
146
- if (res.token)
156
+ if (res.token) {
147
157
  setBearerToken(res.token);
158
+ invalidateCache();
159
+ }
148
160
  return res;
149
161
  }
150
162
  authKit.updateProfile = updateProfile;
@@ -158,8 +170,10 @@ export var authKit;
158
170
  authKit.changeEmail = changeEmail;
159
171
  async function verifyEmailChange(clientId, token) {
160
172
  const res = await post(`/authkit/${encodeURIComponent(clientId)}/account/verify-email-change`, { token });
161
- if (res.token)
173
+ if (res.token) {
162
174
  setBearerToken(res.token);
175
+ invalidateCache();
176
+ }
163
177
  return res;
164
178
  }
165
179
  authKit.verifyEmailChange = verifyEmailChange;
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.14.4 | Generated: 2026-05-16T11:56:46.429Z
3
+ Version: 1.14.5 | Generated: 2026-05-16T12:39:31.377Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.14.4 | Generated: 2026-05-16T11:56:46.429Z
3
+ Version: 1.14.5 | Generated: 2026-05-16T12:39:31.377Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "1.14.4",
3
+ "version": "1.14.5",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",