@crosspost/sdk 0.1.13 → 0.2.0
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 -11
- package/dist/index.js +11 -11
- package/package.json +1 -1
- package/src/api/auth.ts +1 -0
- package/src/utils/popup.ts +14 -12
package/dist/index.cjs
CHANGED
@@ -472,15 +472,6 @@ function openAuthPopup(url, options = {}) {
|
|
472
472
|
} else {
|
473
473
|
reject(message.data);
|
474
474
|
}
|
475
|
-
setTimeout(() => {
|
476
|
-
try {
|
477
|
-
if (popup && !popup.closed) {
|
478
|
-
popup.close();
|
479
|
-
}
|
480
|
-
} catch (e) {
|
481
|
-
console.warn("Failed to close popup window:", e);
|
482
|
-
}
|
483
|
-
}, 100);
|
484
475
|
}
|
485
476
|
};
|
486
477
|
window.addEventListener("message", handleMessage);
|
@@ -498,7 +489,15 @@ function openAuthPopup(url, options = {}) {
|
|
498
489
|
clearInterval(checkClosedInterval);
|
499
490
|
window.removeEventListener("message", handleMessage);
|
500
491
|
if (!messageReceived) {
|
501
|
-
reject(
|
492
|
+
reject({
|
493
|
+
success: false,
|
494
|
+
error: "Authentication cancelled by user.",
|
495
|
+
status: {
|
496
|
+
message: "Authentication Cancelled",
|
497
|
+
code: "AUTH_CANCELLED",
|
498
|
+
details: "The authentication window was closed before completion."
|
499
|
+
}
|
500
|
+
});
|
502
501
|
}
|
503
502
|
}
|
504
503
|
});
|
@@ -556,7 +555,8 @@ var AuthApi = class {
|
|
556
555
|
}
|
557
556
|
return {
|
558
557
|
platform,
|
559
|
-
userId: result.userId
|
558
|
+
userId: result.userId,
|
559
|
+
status: result.status
|
560
560
|
};
|
561
561
|
}
|
562
562
|
/**
|
package/dist/index.js
CHANGED
@@ -426,15 +426,6 @@ function openAuthPopup(url, options = {}) {
|
|
426
426
|
} else {
|
427
427
|
reject(message.data);
|
428
428
|
}
|
429
|
-
setTimeout(() => {
|
430
|
-
try {
|
431
|
-
if (popup && !popup.closed) {
|
432
|
-
popup.close();
|
433
|
-
}
|
434
|
-
} catch (e) {
|
435
|
-
console.warn("Failed to close popup window:", e);
|
436
|
-
}
|
437
|
-
}, 100);
|
438
429
|
}
|
439
430
|
};
|
440
431
|
window.addEventListener("message", handleMessage);
|
@@ -452,7 +443,15 @@ function openAuthPopup(url, options = {}) {
|
|
452
443
|
clearInterval(checkClosedInterval);
|
453
444
|
window.removeEventListener("message", handleMessage);
|
454
445
|
if (!messageReceived) {
|
455
|
-
reject(
|
446
|
+
reject({
|
447
|
+
success: false,
|
448
|
+
error: "Authentication cancelled by user.",
|
449
|
+
status: {
|
450
|
+
message: "Authentication Cancelled",
|
451
|
+
code: "AUTH_CANCELLED",
|
452
|
+
details: "The authentication window was closed before completion."
|
453
|
+
}
|
454
|
+
});
|
456
455
|
}
|
457
456
|
}
|
458
457
|
});
|
@@ -510,7 +509,8 @@ var AuthApi = class {
|
|
510
509
|
}
|
511
510
|
return {
|
512
511
|
platform,
|
513
|
-
userId: result.userId
|
512
|
+
userId: result.userId,
|
513
|
+
status: result.status
|
514
514
|
};
|
515
515
|
}
|
516
516
|
/**
|
package/package.json
CHANGED
package/src/api/auth.ts
CHANGED
package/src/utils/popup.ts
CHANGED
@@ -19,6 +19,11 @@ interface AuthCallbackData {
|
|
19
19
|
userId?: string;
|
20
20
|
error?: string;
|
21
21
|
error_description?: string;
|
22
|
+
status: {
|
23
|
+
message: string; // User-friendly status message
|
24
|
+
code: string; // Status code for programmatic handling
|
25
|
+
details?: string; // Additional details if needed
|
26
|
+
};
|
22
27
|
}
|
23
28
|
|
24
29
|
interface AuthCallbackMessage {
|
@@ -80,17 +85,6 @@ export function openAuthPopup(url: string, options: PopupOptions = {}): Promise<
|
|
80
85
|
} else {
|
81
86
|
reject(message.data);
|
82
87
|
}
|
83
|
-
|
84
|
-
// Give a moment for any final operations before closing
|
85
|
-
setTimeout(() => {
|
86
|
-
try {
|
87
|
-
if (popup && !popup.closed) {
|
88
|
-
popup.close();
|
89
|
-
}
|
90
|
-
} catch (e) {
|
91
|
-
console.warn('Failed to close popup window:', e);
|
92
|
-
}
|
93
|
-
}, 100);
|
94
88
|
}
|
95
89
|
};
|
96
90
|
|
@@ -115,7 +109,15 @@ export function openAuthPopup(url: string, options: PopupOptions = {}): Promise<
|
|
115
109
|
window.removeEventListener('message', handleMessage as EventListener);
|
116
110
|
|
117
111
|
if (!messageReceived) {
|
118
|
-
reject(
|
112
|
+
reject({
|
113
|
+
success: false,
|
114
|
+
error: 'Authentication cancelled by user.',
|
115
|
+
status: {
|
116
|
+
message: 'Authentication Cancelled',
|
117
|
+
code: 'AUTH_CANCELLED',
|
118
|
+
details: 'The authentication window was closed before completion.',
|
119
|
+
},
|
120
|
+
});
|
119
121
|
}
|
120
122
|
}
|
121
123
|
});
|