@crosspost/sdk 0.1.13 → 0.1.14

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/index.cjs CHANGED
@@ -498,7 +498,15 @@ function openAuthPopup(url, options = {}) {
498
498
  clearInterval(checkClosedInterval);
499
499
  window.removeEventListener("message", handleMessage);
500
500
  if (!messageReceived) {
501
- reject(new Error("Authentication cancelled by user."));
501
+ reject({
502
+ success: false,
503
+ error: "Authentication cancelled by user.",
504
+ status: {
505
+ message: "Authentication Cancelled",
506
+ code: "AUTH_CANCELLED",
507
+ details: "The authentication window was closed before completion."
508
+ }
509
+ });
502
510
  }
503
511
  }
504
512
  });
@@ -556,7 +564,8 @@ var AuthApi = class {
556
564
  }
557
565
  return {
558
566
  platform,
559
- userId: result.userId
567
+ userId: result.userId,
568
+ status: result.status
560
569
  };
561
570
  }
562
571
  /**
package/dist/index.js CHANGED
@@ -452,7 +452,15 @@ function openAuthPopup(url, options = {}) {
452
452
  clearInterval(checkClosedInterval);
453
453
  window.removeEventListener("message", handleMessage);
454
454
  if (!messageReceived) {
455
- reject(new Error("Authentication cancelled by user."));
455
+ reject({
456
+ success: false,
457
+ error: "Authentication cancelled by user.",
458
+ status: {
459
+ message: "Authentication Cancelled",
460
+ code: "AUTH_CANCELLED",
461
+ details: "The authentication window was closed before completion."
462
+ }
463
+ });
456
464
  }
457
465
  }
458
466
  });
@@ -510,7 +518,8 @@ var AuthApi = class {
510
518
  }
511
519
  return {
512
520
  platform,
513
- userId: result.userId
521
+ userId: result.userId,
522
+ status: result.status
514
523
  };
515
524
  }
516
525
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crosspost/sdk",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "SDK for interacting with the Crosspost API",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
package/src/api/auth.ts CHANGED
@@ -85,6 +85,7 @@ export class AuthApi {
85
85
  return {
86
86
  platform,
87
87
  userId: result.userId,
88
+ status: result.status,
88
89
  };
89
90
  }
90
91
 
@@ -1,5 +1,5 @@
1
1
  // @ts-nocheck
2
- import type { PlatformName } from '@crosspost/types';
2
+ import type { AuthStatus, PlatformName } from '@crosspost/types';
3
3
  declare global {
4
4
  interface WindowEventMap {
5
5
  message: MessageEvent<AuthCallbackMessage>;
@@ -19,6 +19,7 @@ interface AuthCallbackData {
19
19
  userId?: string;
20
20
  error?: string;
21
21
  error_description?: string;
22
+ status: AuthStatus;
22
23
  }
23
24
 
24
25
  interface AuthCallbackMessage {
@@ -115,7 +116,15 @@ export function openAuthPopup(url: string, options: PopupOptions = {}): Promise<
115
116
  window.removeEventListener('message', handleMessage as EventListener);
116
117
 
117
118
  if (!messageReceived) {
118
- reject(new Error('Authentication cancelled by user.'));
119
+ reject({
120
+ success: false,
121
+ error: 'Authentication cancelled by user.',
122
+ status: {
123
+ message: 'Authentication Cancelled',
124
+ code: 'AUTH_CANCELLED',
125
+ details: 'The authentication window was closed before completion.',
126
+ },
127
+ });
119
128
  }
120
129
  }
121
130
  });