@dream-api/sdk 0.1.9 → 0.1.11
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 +16 -0
- package/dist/index.mjs +16 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -218,6 +218,22 @@ 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
|
+
urlParams.delete("__clerk_ticket");
|
|
225
|
+
const newUrl = urlParams.toString() ? `${window.location.pathname}?${urlParams}` : window.location.pathname;
|
|
226
|
+
window.history.replaceState({}, "", newUrl);
|
|
227
|
+
try {
|
|
228
|
+
console.log("[DreamAPI] Consuming sign-in ticket...");
|
|
229
|
+
await clerk.client.signIn.create({ strategy: "ticket", ticket });
|
|
230
|
+
console.log("[DreamAPI] Sign-in ticket consumed");
|
|
231
|
+
} catch (err) {
|
|
232
|
+
if (!err?.message?.includes("already been used")) {
|
|
233
|
+
console.error("[DreamAPI] Failed to consume sign-in ticket:", err);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
221
237
|
}
|
|
222
238
|
this.loaded = true;
|
|
223
239
|
await this.checkSession();
|
package/dist/index.mjs
CHANGED
|
@@ -190,6 +190,22 @@ 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
|
+
urlParams.delete("__clerk_ticket");
|
|
197
|
+
const newUrl = urlParams.toString() ? `${window.location.pathname}?${urlParams}` : window.location.pathname;
|
|
198
|
+
window.history.replaceState({}, "", newUrl);
|
|
199
|
+
try {
|
|
200
|
+
console.log("[DreamAPI] Consuming sign-in ticket...");
|
|
201
|
+
await clerk.client.signIn.create({ strategy: "ticket", ticket });
|
|
202
|
+
console.log("[DreamAPI] Sign-in ticket consumed");
|
|
203
|
+
} catch (err) {
|
|
204
|
+
if (!err?.message?.includes("already been used")) {
|
|
205
|
+
console.error("[DreamAPI] Failed to consume sign-in ticket:", err);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
193
209
|
}
|
|
194
210
|
this.loaded = true;
|
|
195
211
|
await this.checkSession();
|