@dream-api/sdk 0.1.10 → 0.1.12

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 CHANGED
@@ -220,16 +220,22 @@ var ClerkManager = class {
220
220
  await clerk.load();
221
221
  const urlParams = new URLSearchParams(window.location.search);
222
222
  const ticket = urlParams.get("__clerk_ticket");
223
- if (ticket && clerk.client?.signIn) {
223
+ if (ticket && clerk.signIn && clerk.setActive) {
224
+ urlParams.delete("__clerk_ticket");
225
+ const newUrl = urlParams.toString() ? `${window.location.pathname}?${urlParams}` : window.location.pathname;
226
+ window.history.replaceState({}, "", newUrl);
224
227
  try {
225
228
  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");
229
+ const result = await clerk.signIn.create({ strategy: "ticket", ticket });
230
+ console.log("[DreamAPI] Sign-in result:", result.status);
231
+ if (result.status === "complete" && result.createdSessionId) {
232
+ await clerk.setActive({ session: result.createdSessionId });
233
+ console.log("[DreamAPI] Session activated");
234
+ }
231
235
  } catch (err) {
232
- console.error("[DreamAPI] Failed to consume sign-in ticket:", err);
236
+ if (!err?.message?.includes("already")) {
237
+ console.error("[DreamAPI] Ticket error:", err?.message);
238
+ }
233
239
  }
234
240
  }
235
241
  }
package/dist/index.mjs CHANGED
@@ -192,16 +192,22 @@ var ClerkManager = class {
192
192
  await clerk.load();
193
193
  const urlParams = new URLSearchParams(window.location.search);
194
194
  const ticket = urlParams.get("__clerk_ticket");
195
- if (ticket && clerk.client?.signIn) {
195
+ if (ticket && clerk.signIn && clerk.setActive) {
196
+ urlParams.delete("__clerk_ticket");
197
+ const newUrl = urlParams.toString() ? `${window.location.pathname}?${urlParams}` : window.location.pathname;
198
+ window.history.replaceState({}, "", newUrl);
196
199
  try {
197
200
  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");
201
+ const result = await clerk.signIn.create({ strategy: "ticket", ticket });
202
+ console.log("[DreamAPI] Sign-in result:", result.status);
203
+ if (result.status === "complete" && result.createdSessionId) {
204
+ await clerk.setActive({ session: result.createdSessionId });
205
+ console.log("[DreamAPI] Session activated");
206
+ }
203
207
  } catch (err) {
204
- console.error("[DreamAPI] Failed to consume sign-in ticket:", err);
208
+ if (!err?.message?.includes("already")) {
209
+ console.error("[DreamAPI] Ticket error:", err?.message);
210
+ }
205
211
  }
206
212
  }
207
213
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dream-api/sdk",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "Official SDK for Dream API - Auth, billing, and usage tracking in one API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",