@dream-api/sdk 0.1.15 → 0.1.16
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 -0
- package/dist/index.mjs +18 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -217,6 +217,24 @@ var ClerkManager = class {
|
|
|
217
217
|
const clerk = getClerk();
|
|
218
218
|
if (clerk) {
|
|
219
219
|
await clerk.load();
|
|
220
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
221
|
+
const ticket = urlParams.get("__clerk_ticket");
|
|
222
|
+
if (ticket && clerk.signIn && clerk.setActive) {
|
|
223
|
+
urlParams.delete("__clerk_ticket");
|
|
224
|
+
const newUrl = urlParams.toString() ? `${window.location.pathname}?${urlParams}` : window.location.pathname;
|
|
225
|
+
window.history.replaceState({}, "", newUrl);
|
|
226
|
+
try {
|
|
227
|
+
const result = await clerk.signIn.create({ strategy: "ticket", ticket });
|
|
228
|
+
if (result.status === "complete" && result.createdSessionId) {
|
|
229
|
+
await clerk.setActive({ session: result.createdSessionId });
|
|
230
|
+
await new Promise((r) => setTimeout(r, 500));
|
|
231
|
+
}
|
|
232
|
+
} catch (err) {
|
|
233
|
+
if (!err?.message?.includes("already")) {
|
|
234
|
+
console.error("[DreamAPI] Ticket error:", err?.message);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
220
238
|
}
|
|
221
239
|
this.loaded = true;
|
|
222
240
|
await this.checkSession();
|
package/dist/index.mjs
CHANGED
|
@@ -189,6 +189,24 @@ var ClerkManager = class {
|
|
|
189
189
|
const clerk = getClerk();
|
|
190
190
|
if (clerk) {
|
|
191
191
|
await clerk.load();
|
|
192
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
193
|
+
const ticket = urlParams.get("__clerk_ticket");
|
|
194
|
+
if (ticket && clerk.signIn && clerk.setActive) {
|
|
195
|
+
urlParams.delete("__clerk_ticket");
|
|
196
|
+
const newUrl = urlParams.toString() ? `${window.location.pathname}?${urlParams}` : window.location.pathname;
|
|
197
|
+
window.history.replaceState({}, "", newUrl);
|
|
198
|
+
try {
|
|
199
|
+
const result = await clerk.signIn.create({ strategy: "ticket", ticket });
|
|
200
|
+
if (result.status === "complete" && result.createdSessionId) {
|
|
201
|
+
await clerk.setActive({ session: result.createdSessionId });
|
|
202
|
+
await new Promise((r) => setTimeout(r, 500));
|
|
203
|
+
}
|
|
204
|
+
} catch (err) {
|
|
205
|
+
if (!err?.message?.includes("already")) {
|
|
206
|
+
console.error("[DreamAPI] Ticket error:", err?.message);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
192
210
|
}
|
|
193
211
|
this.loaded = true;
|
|
194
212
|
await this.checkSession();
|