@dream-api/sdk 0.1.31 → 0.1.32
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 +12 -10
- package/dist/index.mjs +12 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -319,6 +319,17 @@ var ClerkManager = class {
|
|
|
319
319
|
* Get current user info
|
|
320
320
|
*/
|
|
321
321
|
getUser() {
|
|
322
|
+
const clerk = getClerk();
|
|
323
|
+
if (clerk?.user) {
|
|
324
|
+
const user = clerk.user;
|
|
325
|
+
const metadata = user.publicMetadata || {};
|
|
326
|
+
return {
|
|
327
|
+
id: user.id,
|
|
328
|
+
email: user.primaryEmailAddress?.emailAddress || "",
|
|
329
|
+
plan: metadata.plan || "free",
|
|
330
|
+
publishableKey: metadata.publishableKey || ""
|
|
331
|
+
};
|
|
332
|
+
}
|
|
322
333
|
if (this.token) {
|
|
323
334
|
try {
|
|
324
335
|
const parts = this.token.split(".");
|
|
@@ -335,16 +346,7 @@ var ClerkManager = class {
|
|
|
335
346
|
console.error("[DreamAPI] Failed to decode JWT:", e);
|
|
336
347
|
}
|
|
337
348
|
}
|
|
338
|
-
|
|
339
|
-
if (!clerk?.user) return null;
|
|
340
|
-
const user = clerk.user;
|
|
341
|
-
const metadata = user.publicMetadata || {};
|
|
342
|
-
return {
|
|
343
|
-
id: user.id,
|
|
344
|
-
email: user.primaryEmailAddress?.emailAddress || "",
|
|
345
|
-
plan: metadata.plan || "free",
|
|
346
|
-
publishableKey: metadata.publishableKey || ""
|
|
347
|
-
};
|
|
349
|
+
return null;
|
|
348
350
|
}
|
|
349
351
|
/**
|
|
350
352
|
* Get current token
|
package/dist/index.mjs
CHANGED
|
@@ -291,6 +291,17 @@ var ClerkManager = class {
|
|
|
291
291
|
* Get current user info
|
|
292
292
|
*/
|
|
293
293
|
getUser() {
|
|
294
|
+
const clerk = getClerk();
|
|
295
|
+
if (clerk?.user) {
|
|
296
|
+
const user = clerk.user;
|
|
297
|
+
const metadata = user.publicMetadata || {};
|
|
298
|
+
return {
|
|
299
|
+
id: user.id,
|
|
300
|
+
email: user.primaryEmailAddress?.emailAddress || "",
|
|
301
|
+
plan: metadata.plan || "free",
|
|
302
|
+
publishableKey: metadata.publishableKey || ""
|
|
303
|
+
};
|
|
304
|
+
}
|
|
294
305
|
if (this.token) {
|
|
295
306
|
try {
|
|
296
307
|
const parts = this.token.split(".");
|
|
@@ -307,16 +318,7 @@ var ClerkManager = class {
|
|
|
307
318
|
console.error("[DreamAPI] Failed to decode JWT:", e);
|
|
308
319
|
}
|
|
309
320
|
}
|
|
310
|
-
|
|
311
|
-
if (!clerk?.user) return null;
|
|
312
|
-
const user = clerk.user;
|
|
313
|
-
const metadata = user.publicMetadata || {};
|
|
314
|
-
return {
|
|
315
|
-
id: user.id,
|
|
316
|
-
email: user.primaryEmailAddress?.emailAddress || "",
|
|
317
|
-
plan: metadata.plan || "free",
|
|
318
|
-
publishableKey: metadata.publishableKey || ""
|
|
319
|
-
};
|
|
321
|
+
return null;
|
|
320
322
|
}
|
|
321
323
|
/**
|
|
322
324
|
* Get current token
|