@proveanything/smartlinks 1.13.18 → 1.13.19

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.
@@ -10,7 +10,10 @@ export var authKit;
10
10
  * =================================== */
11
11
  /** Login with email + password (public). */
12
12
  async function login(clientId, email, password) {
13
- return post(`/authkit/${encodeURIComponent(clientId)}/auth/login`, { email, password });
13
+ const res = await post(`/authkit/${encodeURIComponent(clientId)}/auth/login`, { email, password });
14
+ if (res.token)
15
+ setBearerToken(res.token);
16
+ return res;
14
17
  }
15
18
  authKit.login = login;
16
19
  /** Register a new user (public). */
@@ -20,7 +23,10 @@ export var authKit;
20
23
  authKit.register = register;
21
24
  /** Google OAuth login (public). */
22
25
  async function googleLogin(clientId, idToken) {
23
- return post(`/authkit/${encodeURIComponent(clientId)}/auth/google`, { idToken });
26
+ const res = await post(`/authkit/${encodeURIComponent(clientId)}/auth/google`, { idToken });
27
+ if (res.token)
28
+ setBearerToken(res.token);
29
+ return res;
24
30
  }
25
31
  authKit.googleLogin = googleLogin;
26
32
  /** Send a magic link email to the user (public). */
@@ -43,7 +49,9 @@ export var authKit;
43
49
  authKit.sendPhoneCode = sendPhoneCode;
44
50
  /** Verify phone verification code (public). */
45
51
  async function verifyPhoneCode(clientId, phoneNumber, code) {
46
- return post(`/authkit/${encodeURIComponent(clientId)}/auth/phone/verify`, { phoneNumber, code });
52
+ const res = await post(`/authkit/${encodeURIComponent(clientId)}/auth/phone/verify`, { phoneNumber, code });
53
+ setBearerToken(res.token);
54
+ return res;
47
55
  }
48
56
  authKit.verifyPhoneCode = verifyPhoneCode;
49
57
  /** Send a WhatsApp verification deep-link (public). */
@@ -64,7 +72,9 @@ export var authKit;
64
72
  authKit.getWhatsAppStatus = getWhatsAppStatus;
65
73
  /** Exchange a verified WhatsApp token for an Auth Kit session (public). */
66
74
  async function exchangeWhatsAppSession(clientId, token, sessionKey) {
67
- return post(`/authkit/${encodeURIComponent(clientId)}/auth/whatsapp/exchange-session`, { token, sessionKey });
75
+ const res = await post(`/authkit/${encodeURIComponent(clientId)}/auth/whatsapp/exchange-session`, { token, sessionKey });
76
+ setBearerToken(res.token);
77
+ return res;
68
78
  }
69
79
  authKit.exchangeWhatsAppSession = exchangeWhatsAppSession;
70
80
  /** Send an SMS click-to-verify link (public). */
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.13.18 | Generated: 2026-05-15T21:59:57.655Z
3
+ Version: 1.13.19 | Generated: 2026-05-16T07:35:10.379Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -162,7 +162,7 @@ Enable/disable automatic "ngrok-skip-browser-warning" header.
162
162
  Replace or augment globally applied custom headers.
163
163
 
164
164
  **setBearerToken**(token: string | undefined) → `void`
165
- Allows setting the bearerToken at runtime (e.g. after login/logout).
165
+ Allows setting the bearerToken at runtime (e.g. after login/logout). Clears the HTTP cache whenever the token actually changes so that stale user-scoped responses (e.g. /account/profile) are not served after a login or logout event.
166
166
 
167
167
  **getBaseURL**() → `string | null`
168
168
  Get the currently configured API base URL. Returns null if initializeApi() has not been called yet.
package/dist/http.d.ts CHANGED
@@ -30,6 +30,9 @@ export declare function setNgrokSkipBrowserWarning(flag: boolean): void;
30
30
  export declare function setExtraHeaders(headers: Record<string, string>): void;
31
31
  /**
32
32
  * Allows setting the bearerToken at runtime (e.g. after login/logout).
33
+ * Clears the HTTP cache whenever the token actually changes so that stale
34
+ * user-scoped responses (e.g. /account/profile) are not served after a
35
+ * login or logout event.
33
36
  */
34
37
  export declare function setBearerToken(token: string | undefined): void;
35
38
  /**
package/dist/http.js CHANGED
@@ -405,9 +405,17 @@ export function setExtraHeaders(headers) {
405
405
  }
406
406
  /**
407
407
  * Allows setting the bearerToken at runtime (e.g. after login/logout).
408
+ * Clears the HTTP cache whenever the token actually changes so that stale
409
+ * user-scoped responses (e.g. /account/profile) are not served after a
410
+ * login or logout event.
408
411
  */
409
412
  export function setBearerToken(token) {
413
+ if (token === bearerToken)
414
+ return;
410
415
  bearerToken = token;
416
+ httpCache.clear();
417
+ if (cachePersistence !== 'none')
418
+ idbClear().catch(() => { });
411
419
  }
412
420
  /**
413
421
  * Get the currently configured API base URL.
package/dist/index.d.ts CHANGED
@@ -28,3 +28,4 @@ AdminMobileHostContext, AdminMobileComponentManifest, AdminMobileBundleManifest,
28
28
  MobileAdminBundleManifest, } from './mobile-admin/types';
29
29
  export { HostCapabilityUnavailableError, HostPermissionDeniedError, HostTimeoutError, } from './mobile-admin/errors';
30
30
  export type { NativeCapability, NativeFacade, ShareFacade, ClipboardFacade, HapticImpactStyle, HapticNotificationStyle, HapticsFacade, NetworkStatus, NetworkFacade, DeviceInfo, DeviceFacade, StorageFacade, QrScanOptions, QrFacade, AuthFacade, NfcReadResult, NfcFacade, RfidScanOptions, RfidFacade, EventsFacade, WebSourceMode, WebSourceConfig, WebSourceFacade, } from './native/types';
31
+ export type { AuthKitUser, UserProfile, ProfileUpdateData, UpdateProfileResponse, SuccessResponse, AuthLoginResponse, MagicLinkSendResponse, MagicLinkVerifyResponse, PhoneSendCodeResponse, PhoneVerifyResponse, PasswordResetRequestResponse, VerifyResetTokenResponse, PasswordResetCompleteResponse, EmailVerificationActionResponse, EmailVerifyTokenResponse, VerifyStatus, WhatsAppReplyCta, WhatsAppReplyOptions, WhatsAppContactData, SendWhatsAppRequest, SendWhatsAppResponse, ExchangeWhatsAppSessionResponse, VerifyWhatsAppResponse, WhatsAppStatusResponse, SendSmsVerifyRequest, SendSmsVerifyResponse, VerifySmsResponse, UpsertContactRequest, UpsertContactResponse, AuthKitBrandingConfig, AuthKitConfig, } from './types/authKit';
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.13.18 | Generated: 2026-05-15T21:59:57.655Z
3
+ Version: 1.13.19 | Generated: 2026-05-16T07:35:10.379Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -162,7 +162,7 @@ Enable/disable automatic "ngrok-skip-browser-warning" header.
162
162
  Replace or augment globally applied custom headers.
163
163
 
164
164
  **setBearerToken**(token: string | undefined) → `void`
165
- Allows setting the bearerToken at runtime (e.g. after login/logout).
165
+ Allows setting the bearerToken at runtime (e.g. after login/logout). Clears the HTTP cache whenever the token actually changes so that stale user-scoped responses (e.g. /account/profile) are not served after a login or logout event.
166
166
 
167
167
  **getBaseURL**() → `string | null`
168
168
  Get the currently configured API base URL. Returns null if initializeApi() has not been called yet.
package/package.json CHANGED
@@ -1,9 +1,15 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "1.13.18",
3
+ "version": "1.13.19",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "default": "./dist/index.js"
11
+ }
12
+ },
7
13
  "files": [
8
14
  "dist/",
9
15
  "docs/",