@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 +11 -2
- package/dist/index.js +11 -2
- package/package.json +1 -1
- package/src/api/auth.ts +1 -0
- package/src/utils/popup.ts +11 -2
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(
|
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(
|
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
package/src/api/auth.ts
CHANGED
package/src/utils/popup.ts
CHANGED
@@ -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(
|
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
|
});
|