@dream-api/sdk 0.1.11 → 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,17 +220,21 @@ 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
224
  urlParams.delete("__clerk_ticket");
225
225
  const newUrl = urlParams.toString() ? `${window.location.pathname}?${urlParams}` : window.location.pathname;
226
226
  window.history.replaceState({}, "", newUrl);
227
227
  try {
228
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");
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
- if (!err?.message?.includes("already been used")) {
233
- console.error("[DreamAPI] Failed to consume sign-in ticket:", err);
236
+ if (!err?.message?.includes("already")) {
237
+ console.error("[DreamAPI] Ticket error:", err?.message);
234
238
  }
235
239
  }
236
240
  }
package/dist/index.mjs CHANGED
@@ -192,17 +192,21 @@ 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
196
  urlParams.delete("__clerk_ticket");
197
197
  const newUrl = urlParams.toString() ? `${window.location.pathname}?${urlParams}` : window.location.pathname;
198
198
  window.history.replaceState({}, "", newUrl);
199
199
  try {
200
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");
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
- if (!err?.message?.includes("already been used")) {
205
- console.error("[DreamAPI] Failed to consume sign-in ticket:", err);
208
+ if (!err?.message?.includes("already")) {
209
+ console.error("[DreamAPI] Ticket error:", err?.message);
206
210
  }
207
211
  }
208
212
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dream-api/sdk",
3
- "version": "0.1.11",
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",