@dream-api/sdk 0.1.4 → 0.1.6

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.d.mts CHANGED
@@ -53,6 +53,7 @@ interface UsageTrackResult {
53
53
  interface Tier {
54
54
  name: string;
55
55
  displayName: string;
56
+ /** Price in cents (e.g., 2900 = $29.00) */
56
57
  price: number;
57
58
  limit: number;
58
59
  priceId: string;
@@ -65,6 +66,7 @@ interface Product {
65
66
  name: string;
66
67
  displayName?: string;
67
68
  description?: string;
69
+ /** Price in cents (e.g., 4900 = $49.00) */
68
70
  price: number;
69
71
  currency?: string;
70
72
  priceId: string;
@@ -363,8 +365,6 @@ declare class DreamAPI {
363
365
  readonly products: ProductAPI;
364
366
  /** Dashboard metrics */
365
367
  readonly dashboard: DashboardAPI;
366
- /** Account management (self-service) */
367
- readonly account: AccountAPI;
368
368
  constructor(config: DreamAPIConfig);
369
369
  /**
370
370
  * Set the end-user JWT token.
@@ -551,23 +551,5 @@ declare class DashboardAPI {
551
551
  totalMRR: number;
552
552
  }>;
553
553
  }
554
- declare class AccountAPI {
555
- private client;
556
- constructor(client: DreamClient);
557
- /**
558
- * Delete the current user's account.
559
- * This permanently removes all user data.
560
- *
561
- * @example
562
- * ```typescript
563
- * await api.account.delete();
564
- * // User is now signed out and deleted
565
- * ```
566
- */
567
- delete(): Promise<{
568
- success: boolean;
569
- message: string;
570
- }>;
571
- }
572
554
 
573
555
  export { type CheckoutResult, type ClerkUser, type CreateCustomerParams, type Customer, type DashboardCustomer, type DashboardMetrics, DreamAPI, type DreamAPIConfig, type DreamAPIError, DreamAPIException, type Order, type PortalResult, type Product, type Tier, type Usage, type UsageTrackResult, type WebhookStatus, DreamAPI as default };
package/dist/index.d.ts CHANGED
@@ -53,6 +53,7 @@ interface UsageTrackResult {
53
53
  interface Tier {
54
54
  name: string;
55
55
  displayName: string;
56
+ /** Price in cents (e.g., 2900 = $29.00) */
56
57
  price: number;
57
58
  limit: number;
58
59
  priceId: string;
@@ -65,6 +66,7 @@ interface Product {
65
66
  name: string;
66
67
  displayName?: string;
67
68
  description?: string;
69
+ /** Price in cents (e.g., 4900 = $49.00) */
68
70
  price: number;
69
71
  currency?: string;
70
72
  priceId: string;
@@ -363,8 +365,6 @@ declare class DreamAPI {
363
365
  readonly products: ProductAPI;
364
366
  /** Dashboard metrics */
365
367
  readonly dashboard: DashboardAPI;
366
- /** Account management (self-service) */
367
- readonly account: AccountAPI;
368
368
  constructor(config: DreamAPIConfig);
369
369
  /**
370
370
  * Set the end-user JWT token.
@@ -551,23 +551,5 @@ declare class DashboardAPI {
551
551
  totalMRR: number;
552
552
  }>;
553
553
  }
554
- declare class AccountAPI {
555
- private client;
556
- constructor(client: DreamClient);
557
- /**
558
- * Delete the current user's account.
559
- * This permanently removes all user data.
560
- *
561
- * @example
562
- * ```typescript
563
- * await api.account.delete();
564
- * // User is now signed out and deleted
565
- * ```
566
- */
567
- delete(): Promise<{
568
- success: boolean;
569
- message: string;
570
- }>;
571
- }
572
554
 
573
555
  export { type CheckoutResult, type ClerkUser, type CreateCustomerParams, type Customer, type DashboardCustomer, type DashboardMetrics, DreamAPI, type DreamAPIConfig, type DreamAPIError, DreamAPIException, type Order, type PortalResult, type Product, type Tier, type Usage, type UsageTrackResult, type WebhookStatus, DreamAPI as default };
package/dist/index.js CHANGED
@@ -182,7 +182,7 @@ var DreamClient = class {
182
182
 
183
183
  // src/clerk.ts
184
184
  var CLERK_PUBLISHABLE_KEY = "pk_test_Y29tcG9zZWQtYmxvd2Zpc2gtNzYuY2xlcmsuYWNjb3VudHMuZGV2JA";
185
- var CLERK_CDN_URL = "https://cdn.jsdelivr.net/npm/@clerk/clerk-js@5/dist/clerk.browser.js";
185
+ var CLERK_CDN_URL = "https://cdn.jsdelivr.net/npm/@clerk/clerk-js@5.118.0/dist/clerk.browser.js";
186
186
  var JWT_TEMPLATE = "end-user-api";
187
187
  function getClerk() {
188
188
  return window.Clerk;
@@ -251,9 +251,10 @@ var ClerkManager = class {
251
251
  if (!clerk?.user) return null;
252
252
  const user = clerk.user;
253
253
  const metadata = user.publicMetadata || {};
254
+ const email = user.primaryEmailAddress?.emailAddress || user.emailAddresses?.[0]?.emailAddress || "";
254
255
  return {
255
256
  id: user.id,
256
- email: user.primaryEmailAddress?.emailAddress || "",
257
+ email,
257
258
  plan: metadata.plan || "free",
258
259
  publishableKey: metadata.publishableKey || ""
259
260
  };
@@ -434,7 +435,6 @@ var DreamAPI = class {
434
435
  this.billing = new BillingAPI(this.client);
435
436
  this.products = new ProductAPI(this.client);
436
437
  this.dashboard = new DashboardAPI(this.client);
437
- this.account = new AccountAPI(this.client);
438
438
  }
439
439
  /**
440
440
  * Set the end-user JWT token.
@@ -630,24 +630,6 @@ var DashboardAPI = class {
630
630
  return this.client.get("/api/dashboard/totals");
631
631
  }
632
632
  };
633
- var AccountAPI = class {
634
- constructor(client) {
635
- this.client = client;
636
- }
637
- /**
638
- * Delete the current user's account.
639
- * This permanently removes all user data.
640
- *
641
- * @example
642
- * ```typescript
643
- * await api.account.delete();
644
- * // User is now signed out and deleted
645
- * ```
646
- */
647
- async delete() {
648
- return this.client.delete("/api/me", true);
649
- }
650
- };
651
633
  var index_default = DreamAPI;
652
634
  // Annotate the CommonJS export names for ESM import in node:
653
635
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -154,7 +154,7 @@ var DreamClient = class {
154
154
 
155
155
  // src/clerk.ts
156
156
  var CLERK_PUBLISHABLE_KEY = "pk_test_Y29tcG9zZWQtYmxvd2Zpc2gtNzYuY2xlcmsuYWNjb3VudHMuZGV2JA";
157
- var CLERK_CDN_URL = "https://cdn.jsdelivr.net/npm/@clerk/clerk-js@5/dist/clerk.browser.js";
157
+ var CLERK_CDN_URL = "https://cdn.jsdelivr.net/npm/@clerk/clerk-js@5.118.0/dist/clerk.browser.js";
158
158
  var JWT_TEMPLATE = "end-user-api";
159
159
  function getClerk() {
160
160
  return window.Clerk;
@@ -223,9 +223,10 @@ var ClerkManager = class {
223
223
  if (!clerk?.user) return null;
224
224
  const user = clerk.user;
225
225
  const metadata = user.publicMetadata || {};
226
+ const email = user.primaryEmailAddress?.emailAddress || user.emailAddresses?.[0]?.emailAddress || "";
226
227
  return {
227
228
  id: user.id,
228
- email: user.primaryEmailAddress?.emailAddress || "",
229
+ email,
229
230
  plan: metadata.plan || "free",
230
231
  publishableKey: metadata.publishableKey || ""
231
232
  };
@@ -406,7 +407,6 @@ var DreamAPI = class {
406
407
  this.billing = new BillingAPI(this.client);
407
408
  this.products = new ProductAPI(this.client);
408
409
  this.dashboard = new DashboardAPI(this.client);
409
- this.account = new AccountAPI(this.client);
410
410
  }
411
411
  /**
412
412
  * Set the end-user JWT token.
@@ -602,24 +602,6 @@ var DashboardAPI = class {
602
602
  return this.client.get("/api/dashboard/totals");
603
603
  }
604
604
  };
605
- var AccountAPI = class {
606
- constructor(client) {
607
- this.client = client;
608
- }
609
- /**
610
- * Delete the current user's account.
611
- * This permanently removes all user data.
612
- *
613
- * @example
614
- * ```typescript
615
- * await api.account.delete();
616
- * // User is now signed out and deleted
617
- * ```
618
- */
619
- async delete() {
620
- return this.client.delete("/api/me", true);
621
- }
622
- };
623
605
  var index_default = DreamAPI;
624
606
  export {
625
607
  DreamAPI,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dream-api/sdk",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
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",