@proveanything/smartlinks 1.13.16 → 1.13.18

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.
@@ -1,4 +1,4 @@
1
- import type { AuthLoginResponse, PhoneSendCodeResponse, PhoneVerifyResponse, PasswordResetRequestResponse, VerifyResetTokenResponse, PasswordResetCompleteResponse, EmailVerificationActionResponse, EmailVerifyTokenResponse, AuthKitConfig, MagicLinkSendResponse, MagicLinkVerifyResponse, UserProfile, ProfileUpdateData, SuccessResponse, SendWhatsAppRequest, SendWhatsAppResponse, ExchangeWhatsAppSessionResponse, VerifyWhatsAppResponse, WhatsAppStatusResponse, SendSmsVerifyRequest, SendSmsVerifyResponse, VerifySmsResponse, UpsertContactRequest, UpsertContactResponse } from "../types/authKit";
1
+ import type { AuthLoginResponse, PhoneSendCodeResponse, PhoneVerifyResponse, PasswordResetRequestResponse, VerifyResetTokenResponse, PasswordResetCompleteResponse, EmailVerificationActionResponse, EmailVerifyTokenResponse, AuthKitConfig, MagicLinkSendResponse, MagicLinkVerifyResponse, UserProfile, UpdateProfileResponse, ProfileUpdateData, SuccessResponse, SendWhatsAppRequest, SendWhatsAppResponse, ExchangeWhatsAppSessionResponse, VerifyWhatsAppResponse, WhatsAppStatusResponse, SendSmsVerifyRequest, SendSmsVerifyResponse, VerifySmsResponse, UpsertContactRequest, UpsertContactResponse } 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*).
@@ -62,7 +62,8 @@ export declare namespace authKit {
62
62
  clientName?: string;
63
63
  }): Promise<EmailVerificationActionResponse>;
64
64
  function getProfile(clientId: string): Promise<UserProfile>;
65
- function updateProfile(clientId: string, data: ProfileUpdateData): Promise<UserProfile>;
65
+ /** Update the authenticated user's profile and replace the bearer token when refreshed claims are returned. */
66
+ function updateProfile(clientId: string, data: ProfileUpdateData): Promise<UpdateProfileResponse>;
66
67
  function changePassword(clientId: string, currentPassword: string, newPassword: string): Promise<SuccessResponse>;
67
68
  function changeEmail(clientId: string, newEmail: string, password: string, redirectUrl: string): Promise<SuccessResponse>;
68
69
  function verifyEmailChange(clientId: string, token: string): Promise<SuccessResponse>;
@@ -122,8 +122,12 @@ export var authKit;
122
122
  return request(`/authkit/${encodeURIComponent(clientId)}/account/profile`);
123
123
  }
124
124
  authKit.getProfile = getProfile;
125
+ /** Update the authenticated user's profile and replace the bearer token when refreshed claims are returned. */
125
126
  async function updateProfile(clientId, data) {
126
- return post(`/authkit/${encodeURIComponent(clientId)}/account/update-profile`, data);
127
+ const res = await post(`/authkit/${encodeURIComponent(clientId)}/account/update-profile`, data);
128
+ if (res.token)
129
+ setBearerToken(res.token);
130
+ return res;
127
131
  }
128
132
  authKit.updateProfile = updateProfile;
129
133
  async function changePassword(clientId, currentPassword, newPassword) {
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.13.16 | Generated: 2026-05-15T19:36:34.712Z
3
+ Version: 1.13.18 | Generated: 2026-05-15T21:59:57.655Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -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
 
@@ -8282,41 +8283,41 @@ Upsert contact identity after lightweight verification (public).
8282
8283
  **getProfile**(clientId: string) → `Promise<UserProfile>`
8283
8284
  Upsert contact identity after lightweight verification (public).
8284
8285
 
8285
- **updateProfile**(clientId: string, data: ProfileUpdateData) → `Promise<UserProfile>`
8286
- Upsert contact identity after lightweight verification (public).
8286
+ **updateProfile**(clientId: string, data: ProfileUpdateData) → `Promise<UpdateProfileResponse>`
8287
+ Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
8287
8288
 
8288
8289
  **changePassword**(clientId: string, currentPassword: string, newPassword: string) → `Promise<SuccessResponse>`
8289
- Upsert contact identity after lightweight verification (public).
8290
+ Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
8290
8291
 
8291
8292
  **changeEmail**(clientId: string, newEmail: string, password: string, redirectUrl: string) → `Promise<SuccessResponse>`
8292
- Upsert contact identity after lightweight verification (public).
8293
+ Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
8293
8294
 
8294
8295
  **verifyEmailChange**(clientId: string, token: string) → `Promise<SuccessResponse>`
8295
- Upsert contact identity after lightweight verification (public).
8296
+ Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
8296
8297
 
8297
8298
  **updatePhone**(clientId: string, phoneNumber: string, verificationCode: string) → `Promise<SuccessResponse>`
8298
- Upsert contact identity after lightweight verification (public).
8299
+ Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
8299
8300
 
8300
8301
  **deleteAccount**(clientId: string, password: string, confirmText: string) → `Promise<SuccessResponse>`
8301
- Upsert contact identity after lightweight verification (public).
8302
+ Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
8302
8303
 
8303
8304
  **load**(authKitId: string) → `Promise<AuthKitConfig>`
8304
- Upsert contact identity after lightweight verification (public).
8305
+ Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
8305
8306
 
8306
8307
  **get**(collectionId: string, authKitId: string) → `Promise<AuthKitConfig>`
8307
- Upsert contact identity after lightweight verification (public).
8308
+ Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
8308
8309
 
8309
8310
  **list**(collectionId: string, admin?: boolean) → `Promise<AuthKitConfig[]>`
8310
- Upsert contact identity after lightweight verification (public).
8311
+ Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
8311
8312
 
8312
8313
  **create**(collectionId: string, data: any) → `Promise<AuthKitConfig>`
8313
- Upsert contact identity after lightweight verification (public).
8314
+ Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
8314
8315
 
8315
8316
  **update**(collectionId: string, authKitId: string, data: any) → `Promise<AuthKitConfig>`
8316
- Upsert contact identity after lightweight verification (public).
8317
+ Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
8317
8318
 
8318
8319
  **remove**(collectionId: string, authKitId: string) → `Promise<void>`
8319
- Upsert contact identity after lightweight verification (public).
8320
+ Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
8320
8321
 
8321
8322
  ### batch
8322
8323
 
@@ -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 using the shared generic Twilio Content template SID (`TWILIO_WHATSAPP_GENERIC_CTA_SID`)
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 |
@@ -197,6 +202,8 @@ const session = await authKit.exchangeWhatsAppSession(clientId, wa.token, wa.ses
197
202
 
198
203
  `sessionKey` is returned by `sendWhatsApp` and is used to mitigate token replay from contexts that did not initiate the browser flow.
199
204
 
205
+ When `contactData.name` or explicit name parts were supplied on the original `sendWhatsApp` call, `session.user.displayName` and the returned bearer token claims are now seeded from the verified contact record instead of staying `null`.
206
+
200
207
  > **Note:** `redirectUrl` is optional. WhatsApp tokens are short hex strings (16 chars) for better UX.
201
208
  >
202
209
  > **Legacy note:** `verifyWhatsApp` is for older phone-bound token flows. Prefer inbound WhatsApp token confirmation plus status polling for new implementations.
@@ -219,7 +226,13 @@ import { authKit } from '@proveanything/smartlinks';
219
226
  const profile = await authKit.getProfile(clientId);
220
227
 
221
228
  // Update profile
222
- await authKit.updateProfile(clientId, { displayName: 'Alice B.', avatarUrl: '...' });
229
+ const updatedProfile = await authKit.updateProfile(clientId, {
230
+ displayName: 'Alice B.',
231
+ avatarUrl: '...'
232
+ });
233
+
234
+ // The SDK automatically swaps in updatedProfile.token so future auth.verify()
235
+ // and authenticated calls use fresh displayName/photoURL claims immediately.
223
236
 
224
237
  // Change password
225
238
  await authKit.changePassword(clientId, 'currentPass', 'newPass');
@@ -231,6 +244,8 @@ await authKit.changeEmail(clientId, 'newemail@example.com', 'password', redirect
231
244
  await authKit.deleteAccount(clientId, 'password', 'DELETE');
232
245
  ```
233
246
 
247
+ `updateProfile` now returns a fresh bearer token together with the updated profile fields. The SDK replaces the in-memory bearer token automatically so token-backed identity reads stay current without an extra refresh step.
248
+
234
249
  ---
235
250
 
236
251
  ## Email verification
package/dist/openapi.yaml CHANGED
@@ -8016,7 +8016,7 @@ paths:
8016
8016
  post:
8017
8017
  tags:
8018
8018
  - authKit
8019
- summary: authKit.updateProfile
8019
+ summary: "Update the authenticated user's profile and replace the bearer token when refreshed claims are returned."
8020
8020
  operationId: authKit_updateProfile
8021
8021
  security: []
8022
8022
  parameters:
@@ -8031,7 +8031,7 @@ paths:
8031
8031
  content:
8032
8032
  application/json:
8033
8033
  schema:
8034
- $ref: "#/components/schemas/UserProfile"
8034
+ $ref: "#/components/schemas/UpdateProfileResponse"
8035
8035
  400:
8036
8036
  description: Bad request
8037
8037
  401:
@@ -17756,6 +17756,13 @@ components:
17756
17756
  accountData:
17757
17757
  type: object
17758
17758
  additionalProperties: true
17759
+ UpdateProfileResponse:
17760
+ type: object
17761
+ properties:
17762
+ token:
17763
+ type: string
17764
+ required:
17765
+ - token
17759
17766
  SuccessResponse:
17760
17767
  type: object
17761
17768
  properties:
@@ -17899,6 +17906,8 @@ components:
17899
17906
  type: string
17900
17907
  buttonUrl:
17901
17908
  type: string
17909
+ mediaUrl:
17910
+ type: string
17902
17911
  required:
17903
17912
  - body
17904
17913
  - buttonLabel
@@ -21,6 +21,9 @@ export interface ProfileUpdateData {
21
21
  photoURL?: string;
22
22
  accountData?: Record<string, any>;
23
23
  }
24
+ export interface UpdateProfileResponse extends UserProfile {
25
+ token: string;
26
+ }
24
27
  export interface SuccessResponse {
25
28
  success: boolean;
26
29
  message?: string;
@@ -80,6 +83,7 @@ export interface WhatsAppReplyCta {
80
83
  body: string;
81
84
  buttonLabel: string;
82
85
  buttonUrl: string;
86
+ mediaUrl?: string;
83
87
  }
84
88
  export interface WhatsAppReplyOptions {
85
89
  /** Option A: explicit Twilio Content SID */
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.13.16 | Generated: 2026-05-15T19:36:34.712Z
3
+ Version: 1.13.18 | Generated: 2026-05-15T21:59:57.655Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -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
 
@@ -8282,41 +8283,41 @@ Upsert contact identity after lightweight verification (public).
8282
8283
  **getProfile**(clientId: string) → `Promise<UserProfile>`
8283
8284
  Upsert contact identity after lightweight verification (public).
8284
8285
 
8285
- **updateProfile**(clientId: string, data: ProfileUpdateData) → `Promise<UserProfile>`
8286
- Upsert contact identity after lightweight verification (public).
8286
+ **updateProfile**(clientId: string, data: ProfileUpdateData) → `Promise<UpdateProfileResponse>`
8287
+ Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
8287
8288
 
8288
8289
  **changePassword**(clientId: string, currentPassword: string, newPassword: string) → `Promise<SuccessResponse>`
8289
- Upsert contact identity after lightweight verification (public).
8290
+ Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
8290
8291
 
8291
8292
  **changeEmail**(clientId: string, newEmail: string, password: string, redirectUrl: string) → `Promise<SuccessResponse>`
8292
- Upsert contact identity after lightweight verification (public).
8293
+ Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
8293
8294
 
8294
8295
  **verifyEmailChange**(clientId: string, token: string) → `Promise<SuccessResponse>`
8295
- Upsert contact identity after lightweight verification (public).
8296
+ Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
8296
8297
 
8297
8298
  **updatePhone**(clientId: string, phoneNumber: string, verificationCode: string) → `Promise<SuccessResponse>`
8298
- Upsert contact identity after lightweight verification (public).
8299
+ Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
8299
8300
 
8300
8301
  **deleteAccount**(clientId: string, password: string, confirmText: string) → `Promise<SuccessResponse>`
8301
- Upsert contact identity after lightweight verification (public).
8302
+ Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
8302
8303
 
8303
8304
  **load**(authKitId: string) → `Promise<AuthKitConfig>`
8304
- Upsert contact identity after lightweight verification (public).
8305
+ Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
8305
8306
 
8306
8307
  **get**(collectionId: string, authKitId: string) → `Promise<AuthKitConfig>`
8307
- Upsert contact identity after lightweight verification (public).
8308
+ Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
8308
8309
 
8309
8310
  **list**(collectionId: string, admin?: boolean) → `Promise<AuthKitConfig[]>`
8310
- Upsert contact identity after lightweight verification (public).
8311
+ Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
8311
8312
 
8312
8313
  **create**(collectionId: string, data: any) → `Promise<AuthKitConfig>`
8313
- Upsert contact identity after lightweight verification (public).
8314
+ Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
8314
8315
 
8315
8316
  **update**(collectionId: string, authKitId: string, data: any) → `Promise<AuthKitConfig>`
8316
- Upsert contact identity after lightweight verification (public).
8317
+ Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
8317
8318
 
8318
8319
  **remove**(collectionId: string, authKitId: string) → `Promise<void>`
8319
- Upsert contact identity after lightweight verification (public).
8320
+ Update the authenticated user's profile and replace the bearer token when refreshed claims are returned.
8320
8321
 
8321
8322
  ### batch
8322
8323
 
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 using the shared generic Twilio Content template SID (`TWILIO_WHATSAPP_GENERIC_CTA_SID`)
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 |
@@ -197,6 +202,8 @@ const session = await authKit.exchangeWhatsAppSession(clientId, wa.token, wa.ses
197
202
 
198
203
  `sessionKey` is returned by `sendWhatsApp` and is used to mitigate token replay from contexts that did not initiate the browser flow.
199
204
 
205
+ When `contactData.name` or explicit name parts were supplied on the original `sendWhatsApp` call, `session.user.displayName` and the returned bearer token claims are now seeded from the verified contact record instead of staying `null`.
206
+
200
207
  > **Note:** `redirectUrl` is optional. WhatsApp tokens are short hex strings (16 chars) for better UX.
201
208
  >
202
209
  > **Legacy note:** `verifyWhatsApp` is for older phone-bound token flows. Prefer inbound WhatsApp token confirmation plus status polling for new implementations.
@@ -219,7 +226,13 @@ import { authKit } from '@proveanything/smartlinks';
219
226
  const profile = await authKit.getProfile(clientId);
220
227
 
221
228
  // Update profile
222
- await authKit.updateProfile(clientId, { displayName: 'Alice B.', avatarUrl: '...' });
229
+ const updatedProfile = await authKit.updateProfile(clientId, {
230
+ displayName: 'Alice B.',
231
+ avatarUrl: '...'
232
+ });
233
+
234
+ // The SDK automatically swaps in updatedProfile.token so future auth.verify()
235
+ // and authenticated calls use fresh displayName/photoURL claims immediately.
223
236
 
224
237
  // Change password
225
238
  await authKit.changePassword(clientId, 'currentPass', 'newPass');
@@ -231,6 +244,8 @@ await authKit.changeEmail(clientId, 'newemail@example.com', 'password', redirect
231
244
  await authKit.deleteAccount(clientId, 'password', 'DELETE');
232
245
  ```
233
246
 
247
+ `updateProfile` now returns a fresh bearer token together with the updated profile fields. The SDK replaces the in-memory bearer token automatically so token-backed identity reads stay current without an extra refresh step.
248
+
234
249
  ---
235
250
 
236
251
  ## Email verification
package/openapi.yaml CHANGED
@@ -8016,7 +8016,7 @@ paths:
8016
8016
  post:
8017
8017
  tags:
8018
8018
  - authKit
8019
- summary: authKit.updateProfile
8019
+ summary: "Update the authenticated user's profile and replace the bearer token when refreshed claims are returned."
8020
8020
  operationId: authKit_updateProfile
8021
8021
  security: []
8022
8022
  parameters:
@@ -8031,7 +8031,7 @@ paths:
8031
8031
  content:
8032
8032
  application/json:
8033
8033
  schema:
8034
- $ref: "#/components/schemas/UserProfile"
8034
+ $ref: "#/components/schemas/UpdateProfileResponse"
8035
8035
  400:
8036
8036
  description: Bad request
8037
8037
  401:
@@ -17756,6 +17756,13 @@ components:
17756
17756
  accountData:
17757
17757
  type: object
17758
17758
  additionalProperties: true
17759
+ UpdateProfileResponse:
17760
+ type: object
17761
+ properties:
17762
+ token:
17763
+ type: string
17764
+ required:
17765
+ - token
17759
17766
  SuccessResponse:
17760
17767
  type: object
17761
17768
  properties:
@@ -17899,6 +17906,8 @@ components:
17899
17906
  type: string
17900
17907
  buttonUrl:
17901
17908
  type: string
17909
+ mediaUrl:
17910
+ type: string
17902
17911
  required:
17903
17912
  - body
17904
17913
  - buttonLabel
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "1.13.16",
3
+ "version": "1.13.18",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",