@dream-api/sdk 0.1.16 → 0.1.17
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 +18 -10
- package/dist/index.mjs +18 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -219,20 +219,28 @@ var ClerkManager = class {
|
|
|
219
219
|
await clerk.load();
|
|
220
220
|
const urlParams = new URLSearchParams(window.location.search);
|
|
221
221
|
const ticket = urlParams.get("__clerk_ticket");
|
|
222
|
-
|
|
222
|
+
console.log("[DreamAPI] Checking for ticket:", ticket ? "YES" : "NO");
|
|
223
|
+
console.log("[DreamAPI] clerk.signIn available:", !!clerk.signIn);
|
|
224
|
+
console.log("[DreamAPI] clerk.setActive available:", !!clerk.setActive);
|
|
225
|
+
if (ticket) {
|
|
223
226
|
urlParams.delete("__clerk_ticket");
|
|
224
227
|
const newUrl = urlParams.toString() ? `${window.location.pathname}?${urlParams}` : window.location.pathname;
|
|
225
228
|
window.history.replaceState({}, "", newUrl);
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
await clerk.
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
229
|
+
if (clerk.signIn && clerk.setActive) {
|
|
230
|
+
try {
|
|
231
|
+
console.log("[DreamAPI] Consuming ticket...");
|
|
232
|
+
const result = await clerk.signIn.create({ strategy: "ticket", ticket });
|
|
233
|
+
console.log("[DreamAPI] Ticket result:", result.status, result.createdSessionId);
|
|
234
|
+
if (result.status === "complete" && result.createdSessionId) {
|
|
235
|
+
await clerk.setActive({ session: result.createdSessionId });
|
|
236
|
+
console.log("[DreamAPI] Session activated!");
|
|
237
|
+
await new Promise((r) => setTimeout(r, 1e3));
|
|
238
|
+
}
|
|
239
|
+
} catch (err) {
|
|
240
|
+
console.error("[DreamAPI] Ticket error:", err?.message, err);
|
|
235
241
|
}
|
|
242
|
+
} else {
|
|
243
|
+
console.error("[DreamAPI] signIn/setActive not available on clerk object");
|
|
236
244
|
}
|
|
237
245
|
}
|
|
238
246
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -191,20 +191,28 @@ var ClerkManager = class {
|
|
|
191
191
|
await clerk.load();
|
|
192
192
|
const urlParams = new URLSearchParams(window.location.search);
|
|
193
193
|
const ticket = urlParams.get("__clerk_ticket");
|
|
194
|
-
|
|
194
|
+
console.log("[DreamAPI] Checking for ticket:", ticket ? "YES" : "NO");
|
|
195
|
+
console.log("[DreamAPI] clerk.signIn available:", !!clerk.signIn);
|
|
196
|
+
console.log("[DreamAPI] clerk.setActive available:", !!clerk.setActive);
|
|
197
|
+
if (ticket) {
|
|
195
198
|
urlParams.delete("__clerk_ticket");
|
|
196
199
|
const newUrl = urlParams.toString() ? `${window.location.pathname}?${urlParams}` : window.location.pathname;
|
|
197
200
|
window.history.replaceState({}, "", newUrl);
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
await clerk.
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
201
|
+
if (clerk.signIn && clerk.setActive) {
|
|
202
|
+
try {
|
|
203
|
+
console.log("[DreamAPI] Consuming ticket...");
|
|
204
|
+
const result = await clerk.signIn.create({ strategy: "ticket", ticket });
|
|
205
|
+
console.log("[DreamAPI] Ticket result:", result.status, result.createdSessionId);
|
|
206
|
+
if (result.status === "complete" && result.createdSessionId) {
|
|
207
|
+
await clerk.setActive({ session: result.createdSessionId });
|
|
208
|
+
console.log("[DreamAPI] Session activated!");
|
|
209
|
+
await new Promise((r) => setTimeout(r, 1e3));
|
|
210
|
+
}
|
|
211
|
+
} catch (err) {
|
|
212
|
+
console.error("[DreamAPI] Ticket error:", err?.message, err);
|
|
207
213
|
}
|
|
214
|
+
} else {
|
|
215
|
+
console.error("[DreamAPI] signIn/setActive not available on clerk object");
|
|
208
216
|
}
|
|
209
217
|
}
|
|
210
218
|
}
|