@cstar.help/js 0.18.2 → 0.18.4

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.cjs CHANGED
@@ -51,7 +51,7 @@ var ErrorType = {
51
51
  API_ERROR: "api_error",
52
52
  SERVER_ERROR: "server_error"
53
53
  };
54
- var DEFAULT_DOC_URL = "https://cstar.help/developers/api/errors";
54
+ var DEFAULT_DOC_URL = "https://www.cstar.help/developers/errors";
55
55
  function normalizeArgs(messageOrStatus, maybeBody, defaults) {
56
56
  if (typeof messageOrStatus === "string") {
57
57
  return {
@@ -94,7 +94,7 @@ var CStarAuthenticationErrorImpl = class extends CStarErrorImpl {
94
94
  const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
95
95
  type: ErrorType.AUTHENTICATION_ERROR,
96
96
  code: "authentication_failed",
97
- doc_url: `${DEFAULT_DOC_URL}#authentication-error`
97
+ doc_url: `${DEFAULT_DOC_URL}#authentication-errors`
98
98
  });
99
99
  super(statusCode, resolved);
100
100
  this.name = "CStarAuthenticationError";
@@ -105,11 +105,11 @@ var CStarRateLimitErrorImpl = class extends CStarErrorImpl {
105
105
  const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
106
106
  type: ErrorType.RATE_LIMIT_ERROR,
107
107
  code: "rate_limit_exceeded",
108
- doc_url: `${DEFAULT_DOC_URL}#rate-limit-error`
108
+ doc_url: `${DEFAULT_DOC_URL}#rate_limit_exceeded`
109
109
  });
110
110
  super(statusCode === 0 ? 429 : statusCode, resolved);
111
111
  this.name = "CStarRateLimitError";
112
- this.retryAfter = retryAfter ?? 60;
112
+ this.retryAfter = retryAfter;
113
113
  }
114
114
  };
115
115
  var CStarNotFoundErrorImpl = class extends CStarErrorImpl {
@@ -117,7 +117,7 @@ var CStarNotFoundErrorImpl = class extends CStarErrorImpl {
117
117
  const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
118
118
  type: ErrorType.NOT_FOUND_ERROR,
119
119
  code: "resource_not_found",
120
- doc_url: `${DEFAULT_DOC_URL}#not-found-error`
120
+ doc_url: `${DEFAULT_DOC_URL}#resource_not_found`
121
121
  });
122
122
  super(statusCode, resolved);
123
123
  this.name = "CStarNotFoundError";
@@ -128,7 +128,7 @@ var CStarValidationErrorImpl = class extends CStarErrorImpl {
128
128
  const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
129
129
  type: ErrorType.INVALID_REQUEST_ERROR,
130
130
  code: "validation_error",
131
- doc_url: `${DEFAULT_DOC_URL}#validation-error`
131
+ doc_url: `${DEFAULT_DOC_URL}#invalid-request-errors`
132
132
  });
133
133
  super(statusCode, resolved);
134
134
  this.name = "CStarValidationError";
@@ -139,7 +139,7 @@ var CStarPermissionErrorImpl = class extends CStarErrorImpl {
139
139
  const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
140
140
  type: ErrorType.PERMISSION_ERROR,
141
141
  code: "permission_denied",
142
- doc_url: `${DEFAULT_DOC_URL}#permission-error`
142
+ doc_url: `${DEFAULT_DOC_URL}#insufficient_permissions`
143
143
  });
144
144
  super(statusCode, resolved);
145
145
  this.name = "CStarPermissionError";
@@ -150,7 +150,7 @@ var CStarConflictErrorImpl = class extends CStarErrorImpl {
150
150
  const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
151
151
  type: ErrorType.CONFLICT_ERROR,
152
152
  code: "conflict",
153
- doc_url: `${DEFAULT_DOC_URL}#conflict-error`
153
+ doc_url: `${DEFAULT_DOC_URL}#resource_conflict`
154
154
  });
155
155
  super(statusCode, resolved);
156
156
  this.name = "CStarConflictError";
@@ -161,7 +161,7 @@ var CStarServerErrorImpl = class extends CStarErrorImpl {
161
161
  const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
162
162
  type: ErrorType.SERVER_ERROR,
163
163
  code: "server_error",
164
- doc_url: `${DEFAULT_DOC_URL}#server-error`
164
+ doc_url: `${DEFAULT_DOC_URL}#server-errors`
165
165
  });
166
166
  super(statusCode, resolved);
167
167
  this.name = "CStarServerError";
@@ -172,7 +172,7 @@ var CStarFeatureDisabledErrorImpl = class extends CStarErrorImpl {
172
172
  const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
173
173
  type: ErrorType.FEATURE_NOT_CONFIGURED,
174
174
  code: "feature_not_configured",
175
- doc_url: `${DEFAULT_DOC_URL}#feature-not-configured`
175
+ doc_url: `${DEFAULT_DOC_URL}#feature_disabled`
176
176
  });
177
177
  super(statusCode, resolved);
178
178
  this.name = "CStarFeatureDisabledError";
@@ -182,12 +182,12 @@ var CStarFeatureDisabledErrorImpl = class extends CStarErrorImpl {
182
182
  };
183
183
  var CStarRealtimeUnavailableErrorImpl = class extends CStarErrorImpl {
184
184
  constructor(message) {
185
- const resolved = message ?? "EventSource is not available in this environment. Real-time subscriptions only work in the browser. Move the call to a client-only path (`useEffect` / `onMount`), or pass an `eventSource` polyfill via the realtime options. See https://cstar.help/developers/sdk/realtime#ssr";
185
+ const resolved = message ?? "EventSource is not available in this environment. Real-time subscriptions only work in the browser. Move the call to a client-only path (`useEffect` / `onMount`), or pass an `eventSource` polyfill via the realtime options. See https://www.cstar.help/developers/sdk/js/realtime#ssr";
186
186
  super(0, {
187
187
  type: ErrorType.API_ERROR,
188
188
  code: "realtime_unavailable",
189
189
  message: resolved,
190
- doc_url: "https://cstar.help/developers/sdk/realtime#ssr"
190
+ doc_url: "https://www.cstar.help/developers/sdk/js/realtime#ssr"
191
191
  });
192
192
  this.name = "CStarRealtimeUnavailableError";
193
193
  }
@@ -263,7 +263,10 @@ function parseError(statusCode, body, retryAfter) {
263
263
  doc_url: DEFAULT_DOC_URL
264
264
  };
265
265
  if (statusCode === 429) {
266
- return new CStarRateLimitError(statusCode, errorBody, retryAfter ?? 60);
266
+ return new CStarRateLimitError(statusCode, errorBody, retryAfter);
267
+ }
268
+ if (errorBody.code === "feature_disabled") {
269
+ return new CStarFeatureDisabledError(statusCode, errorBody);
267
270
  }
268
271
  const StatusCls = STATUS_TO_CLASS[statusCode];
269
272
  if (StatusCls) {
@@ -278,7 +281,7 @@ function parseError(statusCode, body, retryAfter) {
278
281
  }
279
282
 
280
283
  // src/client.ts
281
- var SDK_VERSION = "0.18.2";
284
+ var SDK_VERSION = "0.18.4";
282
285
  var DEFAULT_BASE_URL = "https://www.cstar.help";
283
286
  var DEFAULT_API_VERSION = "2026-03-01";
284
287
  var DEFAULT_MAX_RETRIES = 3;
@@ -298,7 +301,7 @@ var HttpClient = class {
298
301
  this.lastMeta = { requestId: null, timestamp: null, pagination: null };
299
302
  if (!config || typeof config.apiKey !== "string" || config.apiKey.length === 0) {
300
303
  throw new Error(
301
- "[cStar] CStarClient: apiKey is required. Pass a secret key (sk_live_... / sk_test_...). Publishable keys (pk_...) cannot read team endpoints; use them with LibraryClient or CommunityClient. See https://cstar.help/developers/quickstart"
304
+ "[cStar] CStarClient: apiKey is required. Pass a secret key (sk_live_... / sk_test_...). Publishable keys (pk_...) cannot read team endpoints; use them with LibraryClient or CommunityClient. See https://www.cstar.help/developers/quickstart"
302
305
  );
303
306
  }
304
307
  if (typeof config.teamId !== "string" || config.teamId.length === 0) {
@@ -361,7 +364,7 @@ var HttpClient = class {
361
364
  let inProgressWaitMs = null;
362
365
  for (let attempt = 0; attempt <= this.config.maxRetries; attempt++) {
363
366
  if (attempt > 0 && lastError) {
364
- const delay = inProgressWaitMs ?? (lastError instanceof CStarRateLimitError ? Math.min(lastError.retryAfter * 1e3, RATE_LIMIT_RETRY_CAP_MS) : this.getBackoffDelay(attempt));
367
+ const delay = inProgressWaitMs ?? (lastError instanceof CStarRateLimitError ? Math.min((lastError.retryAfter ?? 1) * 1e3, RATE_LIMIT_RETRY_CAP_MS) : this.getBackoffDelay(attempt));
365
368
  inProgressWaitMs = null;
366
369
  await this.sleep(delay);
367
370
  }
@@ -379,7 +382,7 @@ var HttpClient = class {
379
382
  type: "connection_error",
380
383
  code: "network_error",
381
384
  message: `Network request failed: ${networkErr.message}`,
382
- doc_url: "https://www.cstar.help/developers/errors#connection-errors"
385
+ doc_url: "https://www.cstar.help/developers/errors#network_error"
383
386
  });
384
387
  if (canRetryAmbiguousFailure && attempt < this.config.maxRetries) continue;
385
388
  throw lastError;
@@ -415,7 +418,8 @@ var HttpClient = class {
415
418
  }
416
419
  if (response.status === 429) {
417
420
  lastError = parseError(429, errorBody, retryAfter);
418
- if (attempt < this.config.maxRetries) continue;
421
+ const worthWaiting = retryAfter !== void 0 && retryAfter * 1e3 <= RATE_LIMIT_RETRY_CAP_MS;
422
+ if (worthWaiting && attempt < this.config.maxRetries) continue;
419
423
  throw lastError;
420
424
  }
421
425
  lastError = parseError(response.status, errorBody);
@@ -1712,11 +1716,15 @@ var AttachmentsResource = class {
1712
1716
  params?.bucket ? { query: { bucket: params.bucket } } : void 0
1713
1717
  );
1714
1718
  }
1715
- /** Delete an attachment. */
1716
- async del(attachmentId) {
1719
+ /**
1720
+ * Delete a stored file. Pass `storagePath` and `bucket` from `list()`, as
1721
+ * for `get()`. A path with no file in that bucket is a 404.
1722
+ */
1723
+ async del(storagePath, params) {
1717
1724
  return this.client.request(
1718
1725
  "DELETE",
1719
- `/attachments/${attachmentId}`
1726
+ `/attachments/${storagePath}`,
1727
+ params?.bucket ? { query: { bucket: params.bucket } } : void 0
1720
1728
  );
1721
1729
  }
1722
1730
  };
@@ -2108,7 +2116,10 @@ var GameActivityResource = class {
2108
2116
  query: params ? { ...params } : void 0
2109
2117
  });
2110
2118
  }
2111
- /** Get activity for a specific member. */
2119
+ /**
2120
+ * Get activity for a specific member. `memberId` is the player's user id:
2121
+ * the `memberId` game responses return, and `userId` on `members.list()`.
2122
+ */
2112
2123
  async forMember(memberId, params) {
2113
2124
  return this.client.request("GET", `/game/activity/member/${memberId}`, {
2114
2125
  query: params ? { ...params } : void 0
@@ -2297,7 +2308,10 @@ var GameResource = class {
2297
2308
  query: params ? { ...params } : void 0
2298
2309
  });
2299
2310
  }
2300
- /** Get a specific player's stats by membership ID. */
2311
+ /**
2312
+ * Get a specific player's stats. `memberId` is the player's user id: the
2313
+ * `memberId` game responses return, and `userId` on `members.list()`.
2314
+ */
2301
2315
  async getPlayer(memberId) {
2302
2316
  return this.client.request("GET", `/game/player/${memberId}`);
2303
2317
  }
@@ -2586,9 +2600,9 @@ var OfflineQueue = class {
2586
2600
  // src/types/generated/webhookEvents.ts
2587
2601
  var WEBHOOK_EVENT_SAMPLES = {
2588
2602
  "agent.preferences_updated": {
2589
- "team_id": "team_01H8X9YZ7E0J3K4M5N6U",
2590
- "member_id": "mem_01H8X9YZ7E0J3K4M5N6U",
2591
- "agent_id": "agt_01H8X9YZ7E0J3K4M5N6U",
2603
+ "team_id": "550e8400-e29b-41d4-a716-446655440000",
2604
+ "member_id": "550e8400-e29b-41d4-a716-446655440010",
2605
+ "agent_id": "550e8400-e29b-41d4-a716-446655440001",
2592
2606
  "changed": [
2593
2607
  "boringMode"
2594
2608
  ],
@@ -2598,143 +2612,197 @@ var WEBHOOK_EVENT_SAMPLES = {
2598
2612
  },
2599
2613
  "article.created": {
2600
2614
  "article": {
2601
- "id": "art_01H8X9YZ7E0J3K4M5N6U",
2615
+ "id": "art_Yb3kQ9mT2pLx",
2602
2616
  "title": "How to reset your password",
2603
2617
  "slug": "how-to-reset-your-password",
2618
+ "status": "draft",
2604
2619
  "is_public": false,
2605
- "created_at": "2026-04-27T18:42:11.000Z"
2620
+ "published_at": "2026-04-27T19:00:00.000Z",
2621
+ "created_at": "2026-04-27T18:42:11.000Z",
2622
+ "updated_at": "2026-04-27T19:00:00.000Z"
2606
2623
  }
2607
2624
  },
2608
2625
  "article.deleted": {
2609
- "id": "art_01H8X9YZ7E0J3K4M5N6U"
2626
+ "id": "art_Yb3kQ9mT2pLx"
2610
2627
  },
2611
2628
  "article.published": {
2612
2629
  "article": {
2613
- "id": "art_01H8X9YZ7E0J3K4M5N6U",
2630
+ "id": "art_Yb3kQ9mT2pLx",
2614
2631
  "title": "How to reset your password",
2615
2632
  "slug": "how-to-reset-your-password",
2633
+ "status": "published",
2616
2634
  "is_public": true,
2617
- "published_at": "2026-04-27T19:00:00.000Z"
2635
+ "published_at": "2026-04-27T19:00:00.000Z",
2636
+ "created_at": "2026-04-27T18:42:11.000Z",
2637
+ "updated_at": "2026-04-27T19:00:00.000Z"
2618
2638
  }
2619
2639
  },
2620
2640
  "article.updated": {
2621
2641
  "article": {
2622
- "id": "art_01H8X9YZ7E0J3K4M5N6U",
2642
+ "id": "art_Yb3kQ9mT2pLx",
2623
2643
  "title": "How to reset your password (updated)",
2624
2644
  "slug": "how-to-reset-your-password",
2625
- "is_public": true
2645
+ "status": "published",
2646
+ "is_public": true,
2647
+ "published_at": "2026-04-27T19:00:00.000Z",
2648
+ "created_at": "2026-04-27T18:42:11.000Z",
2649
+ "updated_at": "2026-04-27T19:00:00.000Z"
2650
+ },
2651
+ "changes": {
2652
+ "title": {
2653
+ "from": "How to reset your password",
2654
+ "to": "How to reset your password (updated)"
2655
+ },
2656
+ "slug": {
2657
+ "from": "reset-password",
2658
+ "to": "how-to-reset-your-password"
2659
+ },
2660
+ "status": {
2661
+ "from": "draft",
2662
+ "to": "published"
2663
+ },
2664
+ "is_public": {
2665
+ "from": false,
2666
+ "to": true
2667
+ }
2626
2668
  }
2627
2669
  },
2628
2670
  "boss.damaged": {
2629
2671
  "boss": {
2630
- "id": "boss_thunder_drake",
2672
+ "name": "The Thunder Drake",
2631
2673
  "current_hp": 740
2632
2674
  },
2633
2675
  "damage": 120,
2676
+ "defeated": false,
2634
2677
  "by": {
2635
- "agent_id": "usr_01H8X9YZ7E0J3K4M5N6S",
2636
- "name": "Riley"
2678
+ "agent_id": "550e8400-e29b-41d4-a716-446655440001"
2637
2679
  }
2638
2680
  },
2639
2681
  "boss.defeated": {
2640
2682
  "boss": {
2641
- "id": "boss_thunder_drake",
2642
- "name": "The Thunder Drake"
2683
+ "name": "The Thunder Drake",
2684
+ "level": 4
2643
2685
  },
2644
2686
  "final_blow_by": {
2645
- "agent_id": "usr_01H8X9YZ7E0J3K4M5N6S",
2687
+ "agent_id": "550e8400-e29b-41d4-a716-446655440001",
2646
2688
  "name": "Riley"
2647
- },
2648
- "team_xp_awarded": 1500
2689
+ }
2649
2690
  },
2650
2691
  "boss.spawned": {
2651
2692
  "boss": {
2652
2693
  "id": "boss_thunder_drake",
2653
2694
  "name": "The Thunder Drake",
2654
2695
  "level": 4,
2696
+ "type": "dragon",
2697
+ "difficulty": "hard",
2655
2698
  "max_hp": 1200
2656
2699
  }
2657
2700
  },
2658
2701
  "community_post.commented": {
2702
+ "post": {
2703
+ "id": "550e8400-e29b-41d4-a716-446655440040"
2704
+ },
2659
2705
  "comment": {
2660
- "id": "cmt_01H8X9YZ7E0J3K4M5N6X",
2661
- "post_id": "post_01H8X9YZ7E0J3K4M5N6W",
2662
- "content": "I would love this. Bumping for visibility.",
2663
- "author_id": "cus_01H8X9YZ7E0J3K4M5N6Q",
2706
+ "id": "550e8400-e29b-41d4-a716-446655440041",
2707
+ "post_id": "550e8400-e29b-41d4-a716-446655440040",
2708
+ "body": "I would love this. Bumping for visibility.",
2709
+ "is_official": false,
2710
+ "author_name": "Casey Patel",
2664
2711
  "created_at": "2026-04-27T18:55:02.000Z"
2665
2712
  }
2666
2713
  },
2667
2714
  "community_post.created": {
2668
2715
  "post": {
2669
- "id": "post_01H8X9YZ7E0J3K4M5N6W",
2670
- "prefixed_id": "IDEA-42",
2716
+ "id": "550e8400-e29b-41d4-a716-446655440040",
2671
2717
  "title": "Add Slack-style threading to tickets",
2672
2718
  "status": "open",
2673
2719
  "visibility": "public",
2674
- "topic": "feature-requests",
2675
2720
  "created_at": "2026-04-27T18:42:11.000Z"
2676
2721
  }
2677
2722
  },
2678
2723
  "community_post.deleted": {
2679
2724
  "post": {
2680
- "id": "post_01H8X9YZ7E0J3K4M5N6W",
2681
- "prefixed_id": "IDEA-42",
2725
+ "id": "550e8400-e29b-41d4-a716-446655440040",
2682
2726
  "title": "Add Slack-style threading to tickets"
2683
2727
  }
2684
2728
  },
2685
2729
  "community_post.status_changed": {
2686
2730
  "post": {
2687
- "id": "post_01H8X9YZ7E0J3K4M5N6W",
2731
+ "id": "550e8400-e29b-41d4-a716-446655440040",
2688
2732
  "title": "Add Slack-style threading to tickets",
2689
2733
  "status": "planned",
2690
- "visibility": "public"
2691
- }
2734
+ "visibility": "public",
2735
+ "created_at": "2026-04-27T18:42:11.000Z"
2736
+ },
2737
+ "previous_status": "open"
2692
2738
  },
2693
2739
  "community_post.updated": {
2694
2740
  "post": {
2695
- "id": "post_01H8X9YZ7E0J3K4M5N6W",
2741
+ "id": "550e8400-e29b-41d4-a716-446655440040",
2696
2742
  "title": "Add Slack-style threading to tickets (revised)",
2697
2743
  "status": "open",
2698
- "visibility": "public"
2744
+ "visibility": "public",
2745
+ "created_at": "2026-04-27T18:42:11.000Z"
2699
2746
  }
2700
2747
  },
2701
2748
  "community_post.voted": {
2702
2749
  "post": {
2703
- "id": "post_01H8X9YZ7E0J3K4M5N6W",
2750
+ "id": "550e8400-e29b-41d4-a716-446655440040",
2704
2751
  "vote_count": 13
2705
2752
  },
2706
2753
  "voter": {
2707
- "id": "cus_01H8X9YZ7E0J3K4M5N6Q"
2754
+ "id": "cus_no9EfYa0dg5O"
2708
2755
  },
2709
2756
  "direction": "up"
2710
2757
  },
2711
2758
  "customer.created": {
2712
2759
  "customer": {
2713
- "id": "cus_01H8X9YZ7E0J3K4M5N6Q",
2760
+ "id": "cus_no9EfYa0dg5O",
2714
2761
  "name": "Casey Patel",
2715
2762
  "email": "casey@example.com",
2716
2763
  "status": "active",
2764
+ "sentiment": "neutral",
2717
2765
  "tags": [
2718
2766
  "trial"
2719
2767
  ],
2720
- "created_at": "2026-04-27T18:42:11.000Z"
2768
+ "created_at": "2026-04-27T18:42:11.000Z",
2769
+ "updated_at": "2026-04-27T18:42:11.000Z"
2721
2770
  }
2722
2771
  },
2723
2772
  "customer.deleted": {
2724
- "id": "cus_01H8X9YZ7E0J3K4M5N6Q"
2773
+ "id": "cus_no9EfYa0dg5O"
2725
2774
  },
2726
2775
  "customer.updated": {
2727
2776
  "customer": {
2728
- "id": "cus_01H8X9YZ7E0J3K4M5N6Q",
2777
+ "id": "cus_no9EfYa0dg5O",
2729
2778
  "name": "Casey Patel",
2730
2779
  "email": "casey@example.com",
2731
2780
  "status": "active",
2781
+ "sentiment": "neutral",
2732
2782
  "tags": [
2733
2783
  "trial",
2734
2784
  "paying"
2735
- ]
2785
+ ],
2786
+ "created_at": "2026-04-27T18:42:11.000Z",
2787
+ "updated_at": "2026-04-27T18:42:11.000Z"
2736
2788
  },
2737
2789
  "changes": {
2790
+ "name": {
2791
+ "from": "Casey",
2792
+ "to": "Casey Patel"
2793
+ },
2794
+ "email": {
2795
+ "from": "casey@old.example.com",
2796
+ "to": "casey@example.com"
2797
+ },
2798
+ "status": {
2799
+ "from": "active",
2800
+ "to": "inactive"
2801
+ },
2802
+ "sentiment": {
2803
+ "from": "neutral",
2804
+ "to": "happy"
2805
+ },
2738
2806
  "tags": {
2739
2807
  "from": [
2740
2808
  "trial"
@@ -2747,51 +2815,59 @@ var WEBHOOK_EVENT_SAMPLES = {
2747
2815
  }
2748
2816
  },
2749
2817
  "customer_group.created": {
2750
- "group": {
2751
- "id": "grp_01H8X9YZ7E0J3K4M5N6T",
2818
+ "customer_group": {
2819
+ "id": "550e8400-e29b-41d4-a716-446655440030",
2752
2820
  "name": "Pro Plan",
2753
- "color": "indigo",
2754
- "member_count": 0
2821
+ "slug": "pro-plan",
2822
+ "description": "Customers on the Pro plan",
2823
+ "customer_count": 0,
2824
+ "created_at": "2026-04-27T18:42:11.000Z",
2825
+ "updated_at": "2026-04-27T18:42:11.000Z"
2755
2826
  }
2756
2827
  },
2757
2828
  "customer_group.deleted": {
2758
2829
  "customer_group": {
2759
- "id": "grp_01H8X9YZ7E0J3K4M5N6T"
2830
+ "id": "550e8400-e29b-41d4-a716-446655440030"
2760
2831
  }
2761
2832
  },
2762
2833
  "customer_group.updated": {
2763
- "group": {
2764
- "id": "grp_01H8X9YZ7E0J3K4M5N6T",
2834
+ "customer_group": {
2835
+ "id": "550e8400-e29b-41d4-a716-446655440030",
2765
2836
  "name": "Pro Plan (Annual)",
2766
- "color": "indigo",
2767
- "member_count": 38
2837
+ "slug": "pro-plan",
2838
+ "description": "Customers on the Pro plan",
2839
+ "customer_count": 38,
2840
+ "created_at": "2026-04-27T18:42:11.000Z",
2841
+ "updated_at": "2026-04-27T18:42:11.000Z"
2768
2842
  }
2769
2843
  },
2770
2844
  "player.achievement_unlocked": {
2771
2845
  "player": {
2772
- "agent_id": "usr_01H8X9YZ7E0J3K4M5N6S",
2846
+ "agent_id": "550e8400-e29b-41d4-a716-446655440001",
2773
2847
  "name": "Riley"
2774
2848
  },
2775
2849
  "achievement": {
2776
2850
  "id": "first_resolve",
2777
2851
  "name": "First Resolve",
2852
+ "description": "Resolve your first ticket",
2853
+ "rarity": "common",
2778
2854
  "xp": 50
2779
2855
  }
2780
2856
  },
2781
2857
  "player.level_up": {
2782
2858
  "player": {
2783
- "agent_id": "usr_01H8X9YZ7E0J3K4M5N6S",
2859
+ "agent_id": "550e8400-e29b-41d4-a716-446655440001",
2784
2860
  "name": "Riley"
2785
2861
  },
2786
2862
  "level": {
2787
2863
  "from": 7,
2788
2864
  "to": 8
2789
2865
  },
2790
- "title_unlocked": "Apprentice Healer"
2866
+ "total_xp": 4200
2791
2867
  },
2792
2868
  "player.quest_completed": {
2793
2869
  "player": {
2794
- "agent_id": "usr_01H8X9YZ7E0J3K4M5N6S",
2870
+ "agent_id": "550e8400-e29b-41d4-a716-446655440001",
2795
2871
  "name": "Riley"
2796
2872
  },
2797
2873
  "quest": {
@@ -2802,7 +2878,7 @@ var WEBHOOK_EVENT_SAMPLES = {
2802
2878
  },
2803
2879
  "player.streak_milestone": {
2804
2880
  "player": {
2805
- "agent_id": "usr_01H8X9YZ7E0J3K4M5N6S",
2881
+ "agent_id": "550e8400-e29b-41d4-a716-446655440001",
2806
2882
  "name": "Riley"
2807
2883
  },
2808
2884
  "streak_days": 5,
@@ -2810,51 +2886,56 @@ var WEBHOOK_EVENT_SAMPLES = {
2810
2886
  },
2811
2887
  "player.xp_gained": {
2812
2888
  "player": {
2813
- "agent_id": "usr_01H8X9YZ7E0J3K4M5N6S",
2889
+ "agent_id": "550e8400-e29b-41d4-a716-446655440001",
2814
2890
  "name": "Riley"
2815
2891
  },
2816
2892
  "amount": 75,
2817
2893
  "reason": "ticket.resolved",
2818
- "ticket_id": "tkt_01H8X9YZ7E0J3K4M5N6P"
2894
+ "ticket_id": "tkt_UR8A3OR3Vshq"
2819
2895
  },
2820
2896
  "social.high_five_sent": {
2897
+ "id": "550e8400-e29b-41d4-a716-446655440051",
2821
2898
  "from_team": {
2822
- "id": "team_acme",
2899
+ "id": "550e8400-e29b-41d4-a716-446655440000",
2823
2900
  "name": "Acme Support"
2824
2901
  },
2825
2902
  "to_team": {
2826
- "id": "team_globex",
2903
+ "id": "550e8400-e29b-41d4-a716-446655440003",
2827
2904
  "name": "Globex Support"
2828
2905
  },
2829
- "message": "Thanks for the assist!"
2906
+ "sent_by": {
2907
+ "agent_id": "550e8400-e29b-41d4-a716-446655440001",
2908
+ "name": "Riley"
2909
+ },
2910
+ "message": "Thanks for the assist!",
2911
+ "created_at": "2026-04-27T18:55:02.000Z"
2830
2912
  },
2831
2913
  "social.one_up_sent": {
2914
+ "id": "550e8400-e29b-41d4-a716-446655440050",
2832
2915
  "from": {
2833
- "agent_id": "usr_01H8X9YZ7E0J3K4M5N6S",
2916
+ "agent_id": "550e8400-e29b-41d4-a716-446655440001",
2834
2917
  "name": "Riley"
2835
2918
  },
2836
2919
  "to": {
2837
- "agent_id": "usr_01H8X9YZ7E0J3K4M5N6V",
2920
+ "agent_id": "550e8400-e29b-41d4-a716-446655440002",
2838
2921
  "name": "Sam"
2839
2922
  },
2840
- "ticket_id": "tkt_01H8X9YZ7E0J3K4M5N6P",
2841
- "message": "Great empathy on this one"
2923
+ "message": "Great empathy on this one",
2924
+ "gold_amount": 0,
2925
+ "created_at": "2026-04-27T18:55:02.000Z"
2842
2926
  },
2843
2927
  "survey.submitted": {
2844
2928
  "survey": {
2845
- "id": "svy_01H8X9YZ7E0J3K4M5N6Y",
2846
- "ticket_id": "tkt_01H8X9YZ7E0J3K4M5N6P",
2847
- "score": 5,
2929
+ "id": "550e8400-e29b-41d4-a716-446655440060",
2930
+ "ticket_id": "tkt_UR8A3OR3Vshq",
2931
+ "rating": 5,
2848
2932
  "comment": "Resolved fast, thank you!",
2933
+ "agent_id": "550e8400-e29b-41d4-a716-446655440001",
2849
2934
  "submitted_at": "2026-04-27T19:30:00.000Z"
2850
- },
2851
- "customer": {
2852
- "id": "cus_01H8X9YZ7E0J3K4M5N6Q",
2853
- "email": "casey@example.com"
2854
2935
  }
2855
2936
  },
2856
2937
  "team.preferences_updated": {
2857
- "team_id": "team_01H8X9YZ7E0J3K4M5N6U",
2938
+ "team_id": "550e8400-e29b-41d4-a716-446655440000",
2858
2939
  "changed": [
2859
2940
  "bossBattlesEnabled"
2860
2941
  ],
@@ -2864,91 +2945,159 @@ var WEBHOOK_EVENT_SAMPLES = {
2864
2945
  },
2865
2946
  "ticket.assigned": {
2866
2947
  "ticket": {
2867
- "id": "tkt_01H8X9YZ7E0J3K4M5N6P",
2868
- "prefixed_id": "CST-1024"
2948
+ "id": "tkt_UR8A3OR3Vshq",
2949
+ "title": "Cannot reset password",
2950
+ "status": "open",
2951
+ "priority": "normal",
2952
+ "channel": "widget",
2953
+ "tags": [
2954
+ "billing"
2955
+ ],
2956
+ "customer_id": "cus_no9EfYa0dg5O",
2957
+ "assigned_to": "550e8400-e29b-41d4-a716-446655440001",
2958
+ "dashboard_url": "https://www.cstar.help/team/acme/tickets?selected=3d3c850d-b6ff-4117-9dea-87e8dc4ba108",
2959
+ "created_at": "2026-04-27T18:42:11.000Z",
2960
+ "updated_at": "2026-04-27T18:50:02.000Z"
2869
2961
  },
2870
2962
  "assignee": {
2871
- "id": "usr_01H8X9YZ7E0J3K4M5N6S",
2963
+ "id": "550e8400-e29b-41d4-a716-446655440001",
2872
2964
  "name": "Riley",
2873
2965
  "email": "riley@acme.test"
2874
2966
  },
2875
- "previous_assignee": null
2967
+ "previous_assignee": {
2968
+ "id": "550e8400-e29b-41d4-a716-446655440002",
2969
+ "name": "Sam",
2970
+ "email": "sam@acme.test"
2971
+ }
2876
2972
  },
2877
2973
  "ticket.closed": {
2878
2974
  "ticket": {
2879
- "id": "tkt_01H8X9YZ7E0J3K4M5N6P",
2880
- "prefixed_id": "CST-1024",
2975
+ "id": "tkt_UR8A3OR3Vshq",
2881
2976
  "title": "Cannot reset password",
2882
2977
  "status": "closed",
2883
2978
  "priority": "normal",
2884
- "channel": "widget"
2979
+ "channel": "widget",
2980
+ "tags": [
2981
+ "billing"
2982
+ ],
2983
+ "customer_id": "cus_no9EfYa0dg5O",
2984
+ "assigned_to": "550e8400-e29b-41d4-a716-446655440001",
2985
+ "dashboard_url": "https://www.cstar.help/team/acme/tickets?selected=3d3c850d-b6ff-4117-9dea-87e8dc4ba108",
2986
+ "created_at": "2026-04-27T18:42:11.000Z",
2987
+ "updated_at": "2026-04-27T18:50:02.000Z"
2885
2988
  },
2886
2989
  "changes": {
2990
+ "title": {
2991
+ "from": "Cannot reset password",
2992
+ "to": "Password reset link expired"
2993
+ },
2887
2994
  "status": {
2888
2995
  "from": "open",
2889
2996
  "to": "closed"
2997
+ },
2998
+ "priority": {
2999
+ "from": "normal",
3000
+ "to": "high"
3001
+ },
3002
+ "assigned_to": {
3003
+ "from": "550e8400-e29b-41d4-a716-446655440002",
3004
+ "to": "550e8400-e29b-41d4-a716-446655440001"
3005
+ },
3006
+ "tags": {
3007
+ "from": [
3008
+ "billing"
3009
+ ],
3010
+ "to": [
3011
+ "billing",
3012
+ "urgent"
3013
+ ]
2890
3014
  }
2891
3015
  }
2892
3016
  },
2893
3017
  "ticket.created": {
2894
3018
  "ticket": {
2895
- "id": "tkt_01H8X9YZ7E0J3K4M5N6P",
2896
- "prefixed_id": "CST-1024",
3019
+ "id": "tkt_UR8A3OR3Vshq",
2897
3020
  "title": "Cannot reset password",
2898
3021
  "status": "new",
2899
3022
  "priority": "normal",
2900
3023
  "channel": "widget",
2901
- "customer_id": "cus_01H8X9YZ7E0J3K4M5N6Q",
2902
- "created_at": "2026-04-27T18:42:11.000Z"
3024
+ "tags": [
3025
+ "billing"
3026
+ ],
3027
+ "customer_id": "cus_no9EfYa0dg5O",
3028
+ "assigned_to": "550e8400-e29b-41d4-a716-446655440001",
3029
+ "dashboard_url": "https://www.cstar.help/team/acme/tickets?selected=3d3c850d-b6ff-4117-9dea-87e8dc4ba108",
3030
+ "created_at": "2026-04-27T18:42:11.000Z",
3031
+ "updated_at": "2026-04-27T18:50:02.000Z"
2903
3032
  },
2904
3033
  "customer": {
2905
- "id": "cus_01H8X9YZ7E0J3K4M5N6Q",
3034
+ "id": "cus_no9EfYa0dg5O",
2906
3035
  "name": "Casey Patel",
2907
3036
  "email": "casey@example.com"
2908
3037
  }
2909
3038
  },
2910
3039
  "ticket.deleted": {
2911
- "id": "CST-1024"
3040
+ "id": "tkt_UR8A3OR3Vshq"
2912
3041
  },
2913
3042
  "ticket.message_added": {
2914
3043
  "ticket": {
2915
- "id": "tkt_01H8X9YZ7E0J3K4M5N6P",
2916
- "dashboard_url": "https://www.cstar.help/team/acme/tickets?selected=tkt_01H8X9YZ7E0J3K4M5N6P"
3044
+ "id": "tkt_UR8A3OR3Vshq",
3045
+ "dashboard_url": "https://www.cstar.help/team/acme/tickets?selected=3d3c850d-b6ff-4117-9dea-87e8dc4ba108"
2917
3046
  },
2918
3047
  "message": {
2919
- "id": "msg_01H8X9YZ7E0J3K4M5N6R",
3048
+ "id": "msg_Hq2Lm8Xc4RtZ",
2920
3049
  "sender": "agent",
2921
3050
  "sender_name": "Riley",
3051
+ "message_type": "public",
2922
3052
  "content": "I just sent a reset link to your inbox. Let me know if it lands.",
2923
3053
  "created_at": "2026-04-27T18:55:02.000Z"
2924
3054
  },
2925
3055
  "customer": {
2926
- "id": "cus_01H8X9YZ7E0J3K4M5N6Q",
3056
+ "id": "cus_no9EfYa0dg5O",
2927
3057
  "name": "Casey Patel",
2928
3058
  "email": "casey@example.com"
2929
3059
  }
2930
3060
  },
2931
3061
  "ticket.updated": {
2932
3062
  "ticket": {
2933
- "id": "tkt_01H8X9YZ7E0J3K4M5N6P",
2934
- "prefixed_id": "CST-1024",
3063
+ "id": "tkt_UR8A3OR3Vshq",
2935
3064
  "title": "Cannot reset password",
2936
3065
  "status": "open",
2937
3066
  "priority": "high",
2938
- "channel": "widget"
3067
+ "channel": "widget",
3068
+ "tags": [
3069
+ "billing"
3070
+ ],
3071
+ "customer_id": "cus_no9EfYa0dg5O",
3072
+ "assigned_to": "550e8400-e29b-41d4-a716-446655440001",
3073
+ "dashboard_url": "https://www.cstar.help/team/acme/tickets?selected=3d3c850d-b6ff-4117-9dea-87e8dc4ba108",
3074
+ "created_at": "2026-04-27T18:42:11.000Z",
3075
+ "updated_at": "2026-04-27T18:50:02.000Z"
2939
3076
  },
2940
3077
  "changes": {
3078
+ "title": {
3079
+ "from": "Cannot reset password",
3080
+ "to": "Password reset link expired"
3081
+ },
3082
+ "status": {
3083
+ "from": "open",
3084
+ "to": "pending"
3085
+ },
2941
3086
  "priority": {
2942
3087
  "from": "normal",
2943
3088
  "to": "high"
2944
3089
  },
3090
+ "assigned_to": {
3091
+ "from": "550e8400-e29b-41d4-a716-446655440002",
3092
+ "to": "550e8400-e29b-41d4-a716-446655440001"
3093
+ },
2945
3094
  "tags": {
2946
3095
  "from": [
2947
- "bug"
3096
+ "billing"
2948
3097
  ],
2949
3098
  "to": [
2950
- "bug",
2951
- "feature-request"
3099
+ "billing",
3100
+ "urgent"
2952
3101
  ]
2953
3102
  }
2954
3103
  }
@@ -3027,7 +3176,7 @@ var CStarClient = class {
3027
3176
  this.ai = new AiResource(this._httpClient);
3028
3177
  this.views = new ViewsResource(this._httpClient);
3029
3178
  this.billing = new BillingResource(this._httpClient);
3030
- this.realtime = new CStarRealtime(this._httpClient);
3179
+ this.realtime = new CStarRealtime(this._httpClient, config.realtime);
3031
3180
  if (config.offline) {
3032
3181
  const queueOpts = typeof config.offline === "object" ? config.offline : void 0;
3033
3182
  this.offlineQueue = new OfflineQueue(this._httpClient, queueOpts);