@proveanything/smartlinks 1.9.5 → 1.9.6

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,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.9.5 | Generated: 2026-03-23T20:19:00.201Z
3
+ Version: 1.9.6 | Generated: 2026-03-28T15:04:22.535Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -4468,6 +4468,8 @@ interface ProxyResponse {
4468
4468
  id: string;
4469
4469
  data?: any;
4470
4470
  error?: string;
4471
+ statusCode?: number;
4472
+ errorBody?: any;
4471
4473
  }
4472
4474
  ```
4473
4475
 
package/dist/http.js CHANGED
@@ -680,6 +680,7 @@ function ensureProxyListener() {
680
680
  if (window._smartlinksProxyListener)
681
681
  return;
682
682
  window.addEventListener("message", (event) => {
683
+ var _a;
683
684
  const msg = event.data;
684
685
  if ((msg === null || msg === void 0 ? void 0 : msg._smartlinksProxyStream) && msg.id) {
685
686
  const pendingStream = proxyStreamPending.get(msg.id);
@@ -705,7 +706,13 @@ function ensureProxyListener() {
705
706
  const pending = proxyPending[msg.id];
706
707
  if (pending) {
707
708
  if (msg.error) {
708
- pending.reject(new Error(msg.error));
709
+ if (msg.statusCode) {
710
+ const errBody = normalizeErrorResponse((_a = msg.errorBody) !== null && _a !== void 0 ? _a : msg.error, msg.statusCode);
711
+ pending.reject(new SmartlinksApiError(msg.error, msg.statusCode, errBody));
712
+ }
713
+ else {
714
+ pending.reject(new Error(msg.error));
715
+ }
709
716
  }
710
717
  else {
711
718
  pending.resolve(msg.data);
@@ -429,8 +429,15 @@ export class IframeResponder {
429
429
  fetchOptions.headers = Object.assign(Object.assign({}, fetchOptions.headers), { 'Content-Type': 'application/json' });
430
430
  }
431
431
  const fetchResponse = await fetch(fullUrl, fetchOptions);
432
- const responseData = await fetchResponse.json();
433
- response.data = responseData;
432
+ const responseData = await fetchResponse.json().catch(() => null);
433
+ if (!fetchResponse.ok) {
434
+ response.error = (responseData === null || responseData === void 0 ? void 0 : responseData.message) || `Request failed with status ${fetchResponse.status}`;
435
+ response.statusCode = fetchResponse.status;
436
+ response.errorBody = responseData;
437
+ }
438
+ else {
439
+ response.data = responseData;
440
+ }
434
441
  }
435
442
  catch (err) {
436
443
  console.error('[IframeResponder] Proxy request error:', err);
package/dist/openapi.yaml CHANGED
@@ -18762,6 +18762,9 @@ components:
18762
18762
  data: {}
18763
18763
  error:
18764
18764
  type: string
18765
+ statusCode:
18766
+ type: number
18767
+ errorBody: {}
18765
18768
  required:
18766
18769
  - _smartlinksProxyResponse
18767
18770
  - id
@@ -67,6 +67,8 @@ export interface ProxyResponse {
67
67
  id: string;
68
68
  data?: any;
69
69
  error?: string;
70
+ statusCode?: number;
71
+ errorBody?: any;
70
72
  }
71
73
  export interface ProxyStreamRequest {
72
74
  _smartlinksProxyStreamRequest: true;
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.9.5 | Generated: 2026-03-23T20:19:00.201Z
3
+ Version: 1.9.6 | Generated: 2026-03-28T15:04:22.535Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -4468,6 +4468,8 @@ interface ProxyResponse {
4468
4468
  id: string;
4469
4469
  data?: any;
4470
4470
  error?: string;
4471
+ statusCode?: number;
4472
+ errorBody?: any;
4471
4473
  }
4472
4474
  ```
4473
4475
 
package/openapi.yaml CHANGED
@@ -18762,6 +18762,9 @@ components:
18762
18762
  data: {}
18763
18763
  error:
18764
18764
  type: string
18765
+ statusCode:
18766
+ type: number
18767
+ errorBody: {}
18765
18768
  required:
18766
18769
  - _smartlinksProxyResponse
18767
18770
  - id
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "1.9.5",
3
+ "version": "1.9.6",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",