@stackbe/sdk 0.11.0 → 0.12.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,66 @@
1
+ # Changelog
2
+
3
+ All notable changes to the StackBE SDK will be documented in this file.
4
+
5
+ ## [0.11.1] - 2026-01-09
6
+
7
+ ### Changed
8
+ - CHANGELOG.md now included in npm package for better visibility of changes
9
+
10
+ ## [0.11.0] - 2026-01-09
11
+
12
+ ### Backend Compatibility
13
+ All SDK methods now have full API backend support:
14
+
15
+ - **`checkout.getSession()`** - Retrieve checkout session status by ID
16
+ - **`subscriptions.update()`** - Change subscription plans with proration support
17
+ - **`entitlements.check()`** - Check customer access to specific features
18
+ - **`entitlements.getAll()`** - Get all entitlements for a customer
19
+ - **`customers.update()`** - Update customer name and metadata
20
+
21
+ ### API Endpoints Added
22
+ - `GET /v1/checkout/session/:sessionId` - Get checkout session details
23
+ - `PATCH /v1/subscriptions/:id` - Update subscription (plan changes)
24
+ - `GET /v1/customers/:customerId/entitlements` - List customer entitlements
25
+ - `GET /v1/customers/:customerId/entitlements/check` - Check feature access
26
+ - `PATCH /v1/customers/:id` - Update customer properties
27
+
28
+ ## [0.10.0] - 2025-01-08
29
+
30
+ ### Added
31
+ - Initial public release
32
+ - Full TypeScript support
33
+ - 88 SDK methods covering:
34
+ - Authentication (magic links)
35
+ - Checkout sessions
36
+ - Subscriptions (CRUD, pause/resume, trials, dunning)
37
+ - Entitlements
38
+ - Usage tracking
39
+ - Analytics
40
+ - Customers
41
+ - Organizations
42
+ - Affiliates
43
+ - Coupons
44
+ - Feature requests
45
+ - Early access
46
+
47
+ ## [0.9.0] - 2024-12-30
48
+
49
+ ### Added
50
+ - Affiliate system endpoints
51
+ - Organization management
52
+ - Analytics dashboard methods
53
+
54
+ ## [0.8.0] - 2024-12-20
55
+
56
+ ### Added
57
+ - Dunning/payment recovery methods
58
+ - Trial management (extend, end)
59
+ - Grace period support
60
+
61
+ ## [0.7.0] - 2024-12-15
62
+
63
+ ### Added
64
+ - Subscription pause/resume
65
+ - Billing history endpoints
66
+ - Invoice retrieval
package/README.md CHANGED
@@ -298,6 +298,9 @@ const org = await stackbe.organizations.create({
298
298
  // List all organizations
299
299
  const orgs = await stackbe.organizations.list();
300
300
 
301
+ // List organizations for a specific customer (for org switchers)
302
+ const customerOrgs = await stackbe.organizations.listByCustomer('cust_123');
303
+
301
304
  // Get organization by ID
302
305
  const org = await stackbe.organizations.get('org_123');
303
306
 
package/dist/index.d.mts CHANGED
@@ -1502,6 +1502,17 @@ declare class OrganizationsClient {
1502
1502
  offset?: number;
1503
1503
  search?: string;
1504
1504
  }): Promise<Organization[]>;
1505
+ /**
1506
+ * List organizations where a specific customer is a member.
1507
+ * Useful for building org switchers or checking what orgs a user belongs to.
1508
+ *
1509
+ * @example
1510
+ * ```typescript
1511
+ * const orgs = await stackbe.organizations.listByCustomer('cust_123');
1512
+ * orgs.forEach(org => console.log(`${org.name} - ${org.members.find(m => m.customerId === 'cust_123')?.role}`));
1513
+ * ```
1514
+ */
1515
+ listByCustomer(customerId: string): Promise<Organization[]>;
1505
1516
  /**
1506
1517
  * Get an organization by ID.
1507
1518
  *
package/dist/index.d.ts CHANGED
@@ -1502,6 +1502,17 @@ declare class OrganizationsClient {
1502
1502
  offset?: number;
1503
1503
  search?: string;
1504
1504
  }): Promise<Organization[]>;
1505
+ /**
1506
+ * List organizations where a specific customer is a member.
1507
+ * Useful for building org switchers or checking what orgs a user belongs to.
1508
+ *
1509
+ * @example
1510
+ * ```typescript
1511
+ * const orgs = await stackbe.organizations.listByCustomer('cust_123');
1512
+ * orgs.forEach(org => console.log(`${org.name} - ${org.members.find(m => m.customerId === 'cust_123')?.role}`));
1513
+ * ```
1514
+ */
1515
+ listByCustomer(customerId: string): Promise<Organization[]>;
1505
1516
  /**
1506
1517
  * Get an organization by ID.
1507
1518
  *
package/dist/index.js CHANGED
@@ -1504,6 +1504,21 @@ var OrganizationsClient = class {
1504
1504
  const path = `/v1/apps/${this.appId}/admin/organizations${query ? `?${query}` : ""}`;
1505
1505
  return this.http.get(path);
1506
1506
  }
1507
+ /**
1508
+ * List organizations where a specific customer is a member.
1509
+ * Useful for building org switchers or checking what orgs a user belongs to.
1510
+ *
1511
+ * @example
1512
+ * ```typescript
1513
+ * const orgs = await stackbe.organizations.listByCustomer('cust_123');
1514
+ * orgs.forEach(org => console.log(`${org.name} - ${org.members.find(m => m.customerId === 'cust_123')?.role}`));
1515
+ * ```
1516
+ */
1517
+ async listByCustomer(customerId) {
1518
+ return this.http.get(
1519
+ `/v1/apps/${this.appId}/admin/organizations/by-customer/${customerId}`
1520
+ );
1521
+ }
1507
1522
  /**
1508
1523
  * Get an organization by ID.
1509
1524
  *
package/dist/index.mjs CHANGED
@@ -1463,6 +1463,21 @@ var OrganizationsClient = class {
1463
1463
  const path = `/v1/apps/${this.appId}/admin/organizations${query ? `?${query}` : ""}`;
1464
1464
  return this.http.get(path);
1465
1465
  }
1466
+ /**
1467
+ * List organizations where a specific customer is a member.
1468
+ * Useful for building org switchers or checking what orgs a user belongs to.
1469
+ *
1470
+ * @example
1471
+ * ```typescript
1472
+ * const orgs = await stackbe.organizations.listByCustomer('cust_123');
1473
+ * orgs.forEach(org => console.log(`${org.name} - ${org.members.find(m => m.customerId === 'cust_123')?.role}`));
1474
+ * ```
1475
+ */
1476
+ async listByCustomer(customerId) {
1477
+ return this.http.get(
1478
+ `/v1/apps/${this.appId}/admin/organizations/by-customer/${customerId}`
1479
+ );
1480
+ }
1466
1481
  /**
1467
1482
  * Get an organization by ID.
1468
1483
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackbe/sdk",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "Official JavaScript/TypeScript SDK for StackBE - the billing backend for your side project",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -13,7 +13,8 @@
13
13
  }
14
14
  },
15
15
  "files": [
16
- "dist"
16
+ "dist",
17
+ "CHANGELOG.md"
17
18
  ],
18
19
  "scripts": {
19
20
  "build": "tsup src/index.ts --format cjs,esm --dts --clean",