@dream-api/sdk 0.1.9 → 0.1.10
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.js +14 -0
- package/dist/index.mjs +14 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -218,6 +218,20 @@ var ClerkManager = class {
|
|
|
218
218
|
const clerk = getClerk();
|
|
219
219
|
if (clerk) {
|
|
220
220
|
await clerk.load();
|
|
221
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
222
|
+
const ticket = urlParams.get("__clerk_ticket");
|
|
223
|
+
if (ticket && clerk.client?.signIn) {
|
|
224
|
+
try {
|
|
225
|
+
console.log("[DreamAPI] Consuming sign-in ticket...");
|
|
226
|
+
await clerk.client.signIn.create({ strategy: "ticket", ticket });
|
|
227
|
+
urlParams.delete("__clerk_ticket");
|
|
228
|
+
const newUrl = urlParams.toString() ? `${window.location.pathname}?${urlParams}` : window.location.pathname;
|
|
229
|
+
window.history.replaceState({}, "", newUrl);
|
|
230
|
+
console.log("[DreamAPI] Sign-in ticket consumed successfully");
|
|
231
|
+
} catch (err) {
|
|
232
|
+
console.error("[DreamAPI] Failed to consume sign-in ticket:", err);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
221
235
|
}
|
|
222
236
|
this.loaded = true;
|
|
223
237
|
await this.checkSession();
|
package/dist/index.mjs
CHANGED
|
@@ -190,6 +190,20 @@ var ClerkManager = class {
|
|
|
190
190
|
const clerk = getClerk();
|
|
191
191
|
if (clerk) {
|
|
192
192
|
await clerk.load();
|
|
193
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
194
|
+
const ticket = urlParams.get("__clerk_ticket");
|
|
195
|
+
if (ticket && clerk.client?.signIn) {
|
|
196
|
+
try {
|
|
197
|
+
console.log("[DreamAPI] Consuming sign-in ticket...");
|
|
198
|
+
await clerk.client.signIn.create({ strategy: "ticket", ticket });
|
|
199
|
+
urlParams.delete("__clerk_ticket");
|
|
200
|
+
const newUrl = urlParams.toString() ? `${window.location.pathname}?${urlParams}` : window.location.pathname;
|
|
201
|
+
window.history.replaceState({}, "", newUrl);
|
|
202
|
+
console.log("[DreamAPI] Sign-in ticket consumed successfully");
|
|
203
|
+
} catch (err) {
|
|
204
|
+
console.error("[DreamAPI] Failed to consume sign-in ticket:", err);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
193
207
|
}
|
|
194
208
|
this.loaded = true;
|
|
195
209
|
await this.checkSession();
|