@proveanything/smartlinks 1.13.18 → 1.13.20
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/authKit.js +14 -4
- package/dist/docs/API_SUMMARY.md +2 -2
- package/dist/docs/portal-auth-broadcast.md +3 -27
- package/dist/http.d.ts +3 -0
- package/dist/http.js +8 -0
- package/dist/index.d.ts +1 -0
- package/docs/API_SUMMARY.md +2 -2
- package/docs/portal-auth-broadcast.md +3 -27
- package/package.json +7 -1
package/dist/api/authKit.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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). */
|
package/dist/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 1.13.
|
|
3
|
+
Version: 1.13.20 | Generated: 2026-05-16T07:39:45.235Z
|
|
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.
|
|
@@ -52,32 +52,8 @@ function BidButton() {
|
|
|
52
52
|
|
|
53
53
|
## Iframe Apps (Cross-Origin)
|
|
54
54
|
|
|
55
|
-
Iframe apps don't share React context.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
```ts
|
|
59
|
-
import { authKit } from '@proveanything/smartlinks';
|
|
60
|
-
|
|
61
|
-
// After your custom flow succeeds:
|
|
62
|
-
await authKit.publishLogin({
|
|
63
|
-
token, // string — your API's bearer token
|
|
64
|
-
user: { // mirrors AuthUser
|
|
65
|
-
uid: 'usr_123',
|
|
66
|
-
email: 'bidder@example.com',
|
|
67
|
-
displayName: 'Jane Bidder',
|
|
68
|
-
},
|
|
69
|
-
accountData: { tier: 'gold' }, // optional, free-form
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
// On sign-out:
|
|
73
|
-
await authKit.publishLogout();
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### Raw postMessage (fallback)
|
|
77
|
-
|
|
78
|
-
If you can't use the helper (e.g. you're outside the SDK), post the raw
|
|
79
|
-
messages from the iframe to its parent. The portal's `IframeResponder`
|
|
80
|
-
listens for these:
|
|
55
|
+
Iframe apps don't share React context. Post messages directly from the
|
|
56
|
+
iframe to its parent — the portal's `IframeResponder` listens for these:
|
|
81
57
|
|
|
82
58
|
```ts
|
|
83
59
|
// LOGIN
|
|
@@ -138,7 +114,7 @@ through the standard portal UI.
|
|
|
138
114
|
wiped.
|
|
139
115
|
|
|
140
116
|
❌ Implementing logout by just clearing your own state. Always call
|
|
141
|
-
`useAuth().logout()` (container/widget) or `
|
|
117
|
+
`useAuth().logout()` (container/widget) or post `smartlinks:authkit:logout`
|
|
142
118
|
(iframe) so the whole portal session ends cleanly.
|
|
143
119
|
|
|
144
120
|
---
|
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';
|
package/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 1.13.
|
|
3
|
+
Version: 1.13.20 | Generated: 2026-05-16T07:39:45.235Z
|
|
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.
|
|
@@ -52,32 +52,8 @@ function BidButton() {
|
|
|
52
52
|
|
|
53
53
|
## Iframe Apps (Cross-Origin)
|
|
54
54
|
|
|
55
|
-
Iframe apps don't share React context.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
```ts
|
|
59
|
-
import { authKit } from '@proveanything/smartlinks';
|
|
60
|
-
|
|
61
|
-
// After your custom flow succeeds:
|
|
62
|
-
await authKit.publishLogin({
|
|
63
|
-
token, // string — your API's bearer token
|
|
64
|
-
user: { // mirrors AuthUser
|
|
65
|
-
uid: 'usr_123',
|
|
66
|
-
email: 'bidder@example.com',
|
|
67
|
-
displayName: 'Jane Bidder',
|
|
68
|
-
},
|
|
69
|
-
accountData: { tier: 'gold' }, // optional, free-form
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
// On sign-out:
|
|
73
|
-
await authKit.publishLogout();
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### Raw postMessage (fallback)
|
|
77
|
-
|
|
78
|
-
If you can't use the helper (e.g. you're outside the SDK), post the raw
|
|
79
|
-
messages from the iframe to its parent. The portal's `IframeResponder`
|
|
80
|
-
listens for these:
|
|
55
|
+
Iframe apps don't share React context. Post messages directly from the
|
|
56
|
+
iframe to its parent — the portal's `IframeResponder` listens for these:
|
|
81
57
|
|
|
82
58
|
```ts
|
|
83
59
|
// LOGIN
|
|
@@ -138,7 +114,7 @@ through the standard portal UI.
|
|
|
138
114
|
wiped.
|
|
139
115
|
|
|
140
116
|
❌ Implementing logout by just clearing your own state. Always call
|
|
141
|
-
`useAuth().logout()` (container/widget) or `
|
|
117
|
+
`useAuth().logout()` (container/widget) or post `smartlinks:authkit:logout`
|
|
142
118
|
(iframe) so the whole portal session ends cleanly.
|
|
143
119
|
|
|
144
120
|
---
|
package/package.json
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proveanything/smartlinks",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.20",
|
|
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/",
|