@proveanything/smartlinks 1.13.17 → 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.
- package/dist/api/authKit.js +14 -4
- package/dist/docs/API_SUMMARY.md +3 -2
- package/dist/docs/auth-kit.md +6 -1
- package/dist/http.d.ts +3 -0
- package/dist/http.js +8 -0
- package/dist/index.d.ts +1 -0
- package/dist/openapi.yaml +2 -0
- package/dist/types/authKit.d.ts +1 -0
- package/docs/API_SUMMARY.md +3 -2
- package/docs/auth-kit.md +6 -1
- package/openapi.yaml +2 -0
- 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.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.
|
|
@@ -3030,6 +3030,7 @@ interface WhatsAppReplyCta {
|
|
|
3030
3030
|
body: string
|
|
3031
3031
|
buttonLabel: string
|
|
3032
3032
|
buttonUrl: string
|
|
3033
|
+
mediaUrl?: string // optional image (JPEG/PNG, public https) — selects image card template
|
|
3033
3034
|
}
|
|
3034
3035
|
```
|
|
3035
3036
|
|
package/dist/docs/auth-kit.md
CHANGED
|
@@ -105,6 +105,7 @@ const wa = await authKit.sendWhatsApp(clientId);
|
|
|
105
105
|
// body: "You're verified and ready to bid.",
|
|
106
106
|
// buttonLabel: 'Back to Auction',
|
|
107
107
|
// buttonUrl: '{{returnUrl}}',
|
|
108
|
+
// // mediaUrl: 'https://cdn.example.com/bid-confirmed.jpg', // optional: include to use image card template
|
|
108
109
|
// },
|
|
109
110
|
// text: "You're verified. Return to the app to continue.",
|
|
110
111
|
// },
|
|
@@ -170,11 +171,15 @@ Verification status values returned by `authKit.getWhatsAppStatus` are:
|
|
|
170
171
|
Pass a `reply` object in `sendWhatsApp` to send a message back to the user after they confirm `CONFIRM <token>`. Reply resolution order:
|
|
171
172
|
|
|
172
173
|
1. `reply.contentSid` — explicit Twilio Content SID
|
|
173
|
-
2. `reply.cta` — CTA shorthand
|
|
174
|
+
2. `reply.cta` — CTA shorthand:
|
|
175
|
+
- If `cta.mediaUrl` is present (valid public `https://` URL), uses the **image card** Twilio Content template (`TWILIO_WHATSAPP_IMAGE_CTA_SID`)
|
|
176
|
+
- Otherwise uses the **text CTA** template (`TWILIO_WHATSAPP_GENERIC_CTA_SID`)
|
|
174
177
|
3. `reply.text` — plain-text fallback
|
|
175
178
|
4. Per-client default (`authKit/{clientId}.whatsapp` config)
|
|
176
179
|
5. Built-in default text
|
|
177
180
|
|
|
181
|
+
> **Important:** Only pass `mediaUrl` when you have a valid, publicly reachable `https://` JPEG or PNG. If the field is absent or blank, the text-only CTA template is selected automatically. Never pass an empty string — omit the field entirely to avoid Twilio rejecting the send.
|
|
182
|
+
|
|
178
183
|
The following template placeholders are available in `reply.text`, `reply.cta` fields, and `reply.contentVariables` values:
|
|
179
184
|
|
|
180
185
|
| Placeholder | Description |
|
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/dist/openapi.yaml
CHANGED
|
@@ -17906,6 +17906,8 @@ components:
|
|
|
17906
17906
|
type: string
|
|
17907
17907
|
buttonUrl:
|
|
17908
17908
|
type: string
|
|
17909
|
+
mediaUrl:
|
|
17910
|
+
type: string
|
|
17909
17911
|
required:
|
|
17910
17912
|
- body
|
|
17911
17913
|
- buttonLabel
|
package/dist/types/authKit.d.ts
CHANGED
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.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.
|
|
@@ -3030,6 +3030,7 @@ interface WhatsAppReplyCta {
|
|
|
3030
3030
|
body: string
|
|
3031
3031
|
buttonLabel: string
|
|
3032
3032
|
buttonUrl: string
|
|
3033
|
+
mediaUrl?: string // optional image (JPEG/PNG, public https) — selects image card template
|
|
3033
3034
|
}
|
|
3034
3035
|
```
|
|
3035
3036
|
|
package/docs/auth-kit.md
CHANGED
|
@@ -105,6 +105,7 @@ const wa = await authKit.sendWhatsApp(clientId);
|
|
|
105
105
|
// body: "You're verified and ready to bid.",
|
|
106
106
|
// buttonLabel: 'Back to Auction',
|
|
107
107
|
// buttonUrl: '{{returnUrl}}',
|
|
108
|
+
// // mediaUrl: 'https://cdn.example.com/bid-confirmed.jpg', // optional: include to use image card template
|
|
108
109
|
// },
|
|
109
110
|
// text: "You're verified. Return to the app to continue.",
|
|
110
111
|
// },
|
|
@@ -170,11 +171,15 @@ Verification status values returned by `authKit.getWhatsAppStatus` are:
|
|
|
170
171
|
Pass a `reply` object in `sendWhatsApp` to send a message back to the user after they confirm `CONFIRM <token>`. Reply resolution order:
|
|
171
172
|
|
|
172
173
|
1. `reply.contentSid` — explicit Twilio Content SID
|
|
173
|
-
2. `reply.cta` — CTA shorthand
|
|
174
|
+
2. `reply.cta` — CTA shorthand:
|
|
175
|
+
- If `cta.mediaUrl` is present (valid public `https://` URL), uses the **image card** Twilio Content template (`TWILIO_WHATSAPP_IMAGE_CTA_SID`)
|
|
176
|
+
- Otherwise uses the **text CTA** template (`TWILIO_WHATSAPP_GENERIC_CTA_SID`)
|
|
174
177
|
3. `reply.text` — plain-text fallback
|
|
175
178
|
4. Per-client default (`authKit/{clientId}.whatsapp` config)
|
|
176
179
|
5. Built-in default text
|
|
177
180
|
|
|
181
|
+
> **Important:** Only pass `mediaUrl` when you have a valid, publicly reachable `https://` JPEG or PNG. If the field is absent or blank, the text-only CTA template is selected automatically. Never pass an empty string — omit the field entirely to avoid Twilio rejecting the send.
|
|
182
|
+
|
|
178
183
|
The following template placeholders are available in `reply.text`, `reply.cta` fields, and `reply.contentVariables` values:
|
|
179
184
|
|
|
180
185
|
| Placeholder | Description |
|
package/openapi.yaml
CHANGED
|
@@ -17906,6 +17906,8 @@ components:
|
|
|
17906
17906
|
type: string
|
|
17907
17907
|
buttonUrl:
|
|
17908
17908
|
type: string
|
|
17909
|
+
mediaUrl:
|
|
17910
|
+
type: string
|
|
17909
17911
|
required:
|
|
17910
17912
|
- body
|
|
17911
17913
|
- buttonLabel
|
package/package.json
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proveanything/smartlinks",
|
|
3
|
-
"version": "1.13.
|
|
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/",
|