@cstar.help/js 0.15.1 → 0.16.1
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 +478 -7
- package/dist/index.d.cts +129 -6
- package/dist/index.d.ts +129 -6
- package/dist/index.js +475 -6
- package/dist/webhook/index.d.cts +21 -1
- package/dist/webhook/index.d.ts +21 -1
- package/dist/webhook/node.d.cts +21 -1
- package/dist/webhook/node.d.ts +21 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -33,7 +33,9 @@ __export(src_exports, {
|
|
|
33
33
|
CStarValidationError: () => CStarValidationError,
|
|
34
34
|
ErrorType: () => ErrorType,
|
|
35
35
|
OfflineQueue: () => OfflineQueue,
|
|
36
|
-
Subscription: () => Subscription
|
|
36
|
+
Subscription: () => Subscription,
|
|
37
|
+
WEBHOOK_EVENT_CATALOG: () => WEBHOOK_EVENT_CATALOG,
|
|
38
|
+
WEBHOOK_EVENT_SAMPLES: () => WEBHOOK_EVENT_SAMPLES
|
|
37
39
|
});
|
|
38
40
|
module.exports = __toCommonJS(src_exports);
|
|
39
41
|
|
|
@@ -301,7 +303,7 @@ var HttpClient = class {
|
|
|
301
303
|
}
|
|
302
304
|
if (typeof config.teamId !== "string" || config.teamId.length === 0) {
|
|
303
305
|
throw new Error(
|
|
304
|
-
"[cStar] CStarClient: teamId is required. Find your team ID in Settings \u2192
|
|
306
|
+
"[cStar] CStarClient: teamId is required. Find your team ID in Settings \u2192 API Keys (Team Identifiers) or via `cstar status`."
|
|
305
307
|
);
|
|
306
308
|
}
|
|
307
309
|
this.config = {
|
|
@@ -355,7 +357,8 @@ var HttpClient = class {
|
|
|
355
357
|
let lastError = null;
|
|
356
358
|
for (let attempt = 0; attempt <= this.config.maxRetries; attempt++) {
|
|
357
359
|
if (attempt > 0 && lastError) {
|
|
358
|
-
const
|
|
360
|
+
const RATE_LIMIT_RETRY_CAP_MS = 6e4;
|
|
361
|
+
const delay = lastError instanceof CStarRateLimitError ? Math.min(lastError.retryAfter * 1e3, RATE_LIMIT_RETRY_CAP_MS) : this.getBackoffDelay(attempt);
|
|
359
362
|
await this.sleep(delay);
|
|
360
363
|
}
|
|
361
364
|
let response;
|
|
@@ -507,6 +510,15 @@ var CStarRealtime = class {
|
|
|
507
510
|
this.errorHandlers = /* @__PURE__ */ new Set();
|
|
508
511
|
this.connectionHandlers = /* @__PURE__ */ new Set();
|
|
509
512
|
this.lastEventId = null;
|
|
513
|
+
/**
|
|
514
|
+
* Timestamp of the most recently received event, kept as an ISO-8601 string.
|
|
515
|
+
* Sent as `?since=<iso>` on reconnect so the server can replay events missed
|
|
516
|
+
* during the gap. The `id:` field on each SSE message is a prefixed entity
|
|
517
|
+
* ID (`evt_*`), which `new Date(...)` can't parse — passing it as `since`
|
|
518
|
+
* silently skips the replay branch on the server. Track the timestamp
|
|
519
|
+
* separately so reconnects actually catch up. R62.
|
|
520
|
+
*/
|
|
521
|
+
this.lastEventTimestamp = null;
|
|
510
522
|
this.retryCount = 0;
|
|
511
523
|
this.retryTimer = null;
|
|
512
524
|
this._connected = false;
|
|
@@ -616,8 +628,8 @@ var CStarRealtime = class {
|
|
|
616
628
|
if (this.types && this.types.length > 0) {
|
|
617
629
|
params.set("types", this.types.join(","));
|
|
618
630
|
}
|
|
619
|
-
if (this.
|
|
620
|
-
params.set("since", this.
|
|
631
|
+
if (this.lastEventTimestamp) {
|
|
632
|
+
params.set("since", this.lastEventTimestamp);
|
|
621
633
|
}
|
|
622
634
|
const qs = params.toString();
|
|
623
635
|
const url = `${baseUrl}/events/stream${qs ? `?${qs}` : ""}`;
|
|
@@ -680,6 +692,9 @@ var CStarRealtime = class {
|
|
|
680
692
|
}
|
|
681
693
|
try {
|
|
682
694
|
const parsed = JSON.parse(msgEvent.data);
|
|
695
|
+
if (typeof parsed.timestamp === "string" && parsed.timestamp) {
|
|
696
|
+
this.lastEventTimestamp = parsed.timestamp;
|
|
697
|
+
}
|
|
683
698
|
const realtimeEvent = {
|
|
684
699
|
type: parsed.type || type,
|
|
685
700
|
id: msgEvent.lastEventId || "",
|
|
@@ -710,6 +725,8 @@ var CStarRealtime = class {
|
|
|
710
725
|
}
|
|
711
726
|
this.sseToken = null;
|
|
712
727
|
this.sseTokenExpiresAt = 0;
|
|
728
|
+
this.lastEventId = null;
|
|
729
|
+
this.lastEventTimestamp = null;
|
|
713
730
|
this.setConnected(false);
|
|
714
731
|
this.handlers.clear();
|
|
715
732
|
this.anyHandlers.clear();
|
|
@@ -733,6 +750,9 @@ var CStarRealtime = class {
|
|
|
733
750
|
try {
|
|
734
751
|
const parsed = JSON.parse(event.data);
|
|
735
752
|
if (parsed.type === "connected") return;
|
|
753
|
+
if (typeof parsed.timestamp === "string" && parsed.timestamp) {
|
|
754
|
+
this.lastEventTimestamp = parsed.timestamp;
|
|
755
|
+
}
|
|
736
756
|
const realtimeEvent = {
|
|
737
757
|
type: parsed.type,
|
|
738
758
|
id: event.lastEventId || "",
|
|
@@ -1339,10 +1359,31 @@ var InvitesResource = class {
|
|
|
1339
1359
|
return this.client.request("DELETE", `/invites/${inviteId}`);
|
|
1340
1360
|
}
|
|
1341
1361
|
};
|
|
1362
|
+
var MemberPreferencesResource = class {
|
|
1363
|
+
constructor(client) {
|
|
1364
|
+
this.client = client;
|
|
1365
|
+
}
|
|
1366
|
+
/** Get an agent's UX preferences (boring mode, etc.). */
|
|
1367
|
+
async get(memberId) {
|
|
1368
|
+
return this.client.request(
|
|
1369
|
+
"GET",
|
|
1370
|
+
`/members/${memberId}/preferences`
|
|
1371
|
+
);
|
|
1372
|
+
}
|
|
1373
|
+
/** Update an agent's UX preferences. Only provided fields are written. */
|
|
1374
|
+
async update(memberId, params) {
|
|
1375
|
+
return this.client.request(
|
|
1376
|
+
"PATCH",
|
|
1377
|
+
`/members/${memberId}/preferences`,
|
|
1378
|
+
{ body: params }
|
|
1379
|
+
);
|
|
1380
|
+
}
|
|
1381
|
+
};
|
|
1342
1382
|
var MembersResource = class {
|
|
1343
1383
|
constructor(client) {
|
|
1344
1384
|
this.client = client;
|
|
1345
1385
|
this.invites = new InvitesResource(client);
|
|
1386
|
+
this.preferences = new MemberPreferencesResource(client);
|
|
1346
1387
|
}
|
|
1347
1388
|
/** List all team members. */
|
|
1348
1389
|
async list(params) {
|
|
@@ -1932,7 +1973,7 @@ var AchievementsResource = class {
|
|
|
1932
1973
|
constructor(client) {
|
|
1933
1974
|
this.client = client;
|
|
1934
1975
|
}
|
|
1935
|
-
/** List all achievements with progress. */
|
|
1976
|
+
/** List all achievements with progress. `params.userId` is required. */
|
|
1936
1977
|
async list(params) {
|
|
1937
1978
|
return this.client.request("GET", "/game/achievements", {
|
|
1938
1979
|
query: params
|
|
@@ -2305,6 +2346,23 @@ var BillingResource = class {
|
|
|
2305
2346
|
}
|
|
2306
2347
|
};
|
|
2307
2348
|
|
|
2349
|
+
// src/resources/preferences.ts
|
|
2350
|
+
var PreferencesResource = class {
|
|
2351
|
+
constructor(client) {
|
|
2352
|
+
this.client = client;
|
|
2353
|
+
}
|
|
2354
|
+
/** Get team preferences. */
|
|
2355
|
+
async get() {
|
|
2356
|
+
return this.client.request("GET", "/preferences");
|
|
2357
|
+
}
|
|
2358
|
+
/** Update team preferences. Only provided fields are written. */
|
|
2359
|
+
async update(params) {
|
|
2360
|
+
return this.client.request("PATCH", "/preferences", {
|
|
2361
|
+
body: params
|
|
2362
|
+
});
|
|
2363
|
+
}
|
|
2364
|
+
};
|
|
2365
|
+
|
|
2308
2366
|
// src/offline.ts
|
|
2309
2367
|
var STORAGE_KEY = "cstar_offline_queue";
|
|
2310
2368
|
var OfflineQueue = class {
|
|
@@ -2422,6 +2480,416 @@ var OfflineQueue = class {
|
|
|
2422
2480
|
}
|
|
2423
2481
|
};
|
|
2424
2482
|
|
|
2483
|
+
// src/types/generated/webhookEvents.ts
|
|
2484
|
+
var WEBHOOK_EVENT_SAMPLES = {
|
|
2485
|
+
"agent.preferences_updated": {
|
|
2486
|
+
"team_id": "team_01H8X9YZ7E0J3K4M5N6U",
|
|
2487
|
+
"member_id": "mem_01H8X9YZ7E0J3K4M5N6U",
|
|
2488
|
+
"agent_id": "agt_01H8X9YZ7E0J3K4M5N6U",
|
|
2489
|
+
"changed": [
|
|
2490
|
+
"boringMode"
|
|
2491
|
+
],
|
|
2492
|
+
"preferences": {
|
|
2493
|
+
"boringMode": true
|
|
2494
|
+
}
|
|
2495
|
+
},
|
|
2496
|
+
"article.created": {
|
|
2497
|
+
"article": {
|
|
2498
|
+
"id": "art_01H8X9YZ7E0J3K4M5N6U",
|
|
2499
|
+
"title": "How to reset your password",
|
|
2500
|
+
"slug": "how-to-reset-your-password",
|
|
2501
|
+
"is_public": false,
|
|
2502
|
+
"created_at": "2026-04-27T18:42:11.000Z"
|
|
2503
|
+
}
|
|
2504
|
+
},
|
|
2505
|
+
"article.deleted": {
|
|
2506
|
+
"id": "art_01H8X9YZ7E0J3K4M5N6U"
|
|
2507
|
+
},
|
|
2508
|
+
"article.published": {
|
|
2509
|
+
"article": {
|
|
2510
|
+
"id": "art_01H8X9YZ7E0J3K4M5N6U",
|
|
2511
|
+
"title": "How to reset your password",
|
|
2512
|
+
"slug": "how-to-reset-your-password",
|
|
2513
|
+
"is_public": true,
|
|
2514
|
+
"published_at": "2026-04-27T19:00:00.000Z"
|
|
2515
|
+
}
|
|
2516
|
+
},
|
|
2517
|
+
"article.updated": {
|
|
2518
|
+
"article": {
|
|
2519
|
+
"id": "art_01H8X9YZ7E0J3K4M5N6U",
|
|
2520
|
+
"title": "How to reset your password (updated)",
|
|
2521
|
+
"slug": "how-to-reset-your-password",
|
|
2522
|
+
"is_public": true
|
|
2523
|
+
}
|
|
2524
|
+
},
|
|
2525
|
+
"boss.damaged": {
|
|
2526
|
+
"boss": {
|
|
2527
|
+
"id": "boss_thunder_drake",
|
|
2528
|
+
"current_hp": 740
|
|
2529
|
+
},
|
|
2530
|
+
"damage": 120,
|
|
2531
|
+
"by": {
|
|
2532
|
+
"agent_id": "usr_01H8X9YZ7E0J3K4M5N6S",
|
|
2533
|
+
"name": "Riley"
|
|
2534
|
+
}
|
|
2535
|
+
},
|
|
2536
|
+
"boss.defeated": {
|
|
2537
|
+
"boss": {
|
|
2538
|
+
"id": "boss_thunder_drake",
|
|
2539
|
+
"name": "The Thunder Drake"
|
|
2540
|
+
},
|
|
2541
|
+
"final_blow_by": {
|
|
2542
|
+
"agent_id": "usr_01H8X9YZ7E0J3K4M5N6S",
|
|
2543
|
+
"name": "Riley"
|
|
2544
|
+
},
|
|
2545
|
+
"team_xp_awarded": 1500
|
|
2546
|
+
},
|
|
2547
|
+
"boss.spawned": {
|
|
2548
|
+
"boss": {
|
|
2549
|
+
"id": "boss_thunder_drake",
|
|
2550
|
+
"name": "The Thunder Drake",
|
|
2551
|
+
"level": 4,
|
|
2552
|
+
"max_hp": 1200
|
|
2553
|
+
}
|
|
2554
|
+
},
|
|
2555
|
+
"community_post.commented": {
|
|
2556
|
+
"comment": {
|
|
2557
|
+
"id": "cmt_01H8X9YZ7E0J3K4M5N6X",
|
|
2558
|
+
"post_id": "post_01H8X9YZ7E0J3K4M5N6W",
|
|
2559
|
+
"content": "I would love this \u2014 bumping for visibility.",
|
|
2560
|
+
"author_id": "cus_01H8X9YZ7E0J3K4M5N6Q",
|
|
2561
|
+
"created_at": "2026-04-27T18:55:02.000Z"
|
|
2562
|
+
}
|
|
2563
|
+
},
|
|
2564
|
+
"community_post.created": {
|
|
2565
|
+
"post": {
|
|
2566
|
+
"id": "post_01H8X9YZ7E0J3K4M5N6W",
|
|
2567
|
+
"prefixed_id": "IDEA-42",
|
|
2568
|
+
"title": "Add Slack-style threading to tickets",
|
|
2569
|
+
"status": "open",
|
|
2570
|
+
"visibility": "public",
|
|
2571
|
+
"topic": "feature-requests",
|
|
2572
|
+
"created_at": "2026-04-27T18:42:11.000Z"
|
|
2573
|
+
}
|
|
2574
|
+
},
|
|
2575
|
+
"community_post.deleted": {
|
|
2576
|
+
"post": {
|
|
2577
|
+
"id": "post_01H8X9YZ7E0J3K4M5N6W",
|
|
2578
|
+
"prefixed_id": "IDEA-42",
|
|
2579
|
+
"title": "Add Slack-style threading to tickets"
|
|
2580
|
+
}
|
|
2581
|
+
},
|
|
2582
|
+
"community_post.status_changed": {
|
|
2583
|
+
"post": {
|
|
2584
|
+
"id": "post_01H8X9YZ7E0J3K4M5N6W",
|
|
2585
|
+
"title": "Add Slack-style threading to tickets",
|
|
2586
|
+
"status": "planned",
|
|
2587
|
+
"visibility": "public"
|
|
2588
|
+
}
|
|
2589
|
+
},
|
|
2590
|
+
"community_post.updated": {
|
|
2591
|
+
"post": {
|
|
2592
|
+
"id": "post_01H8X9YZ7E0J3K4M5N6W",
|
|
2593
|
+
"title": "Add Slack-style threading to tickets (revised)",
|
|
2594
|
+
"status": "open",
|
|
2595
|
+
"visibility": "public"
|
|
2596
|
+
}
|
|
2597
|
+
},
|
|
2598
|
+
"community_post.voted": {
|
|
2599
|
+
"post": {
|
|
2600
|
+
"id": "post_01H8X9YZ7E0J3K4M5N6W",
|
|
2601
|
+
"vote_count": 13
|
|
2602
|
+
},
|
|
2603
|
+
"voter": {
|
|
2604
|
+
"id": "cus_01H8X9YZ7E0J3K4M5N6Q"
|
|
2605
|
+
},
|
|
2606
|
+
"direction": "up"
|
|
2607
|
+
},
|
|
2608
|
+
"customer.created": {
|
|
2609
|
+
"customer": {
|
|
2610
|
+
"id": "cus_01H8X9YZ7E0J3K4M5N6Q",
|
|
2611
|
+
"name": "Casey Patel",
|
|
2612
|
+
"email": "casey@example.com",
|
|
2613
|
+
"status": "active",
|
|
2614
|
+
"tags": [
|
|
2615
|
+
"trial"
|
|
2616
|
+
],
|
|
2617
|
+
"created_at": "2026-04-27T18:42:11.000Z"
|
|
2618
|
+
}
|
|
2619
|
+
},
|
|
2620
|
+
"customer.deleted": {
|
|
2621
|
+
"id": "cus_01H8X9YZ7E0J3K4M5N6Q"
|
|
2622
|
+
},
|
|
2623
|
+
"customer.updated": {
|
|
2624
|
+
"customer": {
|
|
2625
|
+
"id": "cus_01H8X9YZ7E0J3K4M5N6Q",
|
|
2626
|
+
"name": "Casey Patel",
|
|
2627
|
+
"email": "casey@example.com",
|
|
2628
|
+
"status": "active",
|
|
2629
|
+
"tags": [
|
|
2630
|
+
"trial",
|
|
2631
|
+
"paying"
|
|
2632
|
+
]
|
|
2633
|
+
},
|
|
2634
|
+
"changes": {
|
|
2635
|
+
"tags": {
|
|
2636
|
+
"from": [
|
|
2637
|
+
"trial"
|
|
2638
|
+
],
|
|
2639
|
+
"to": [
|
|
2640
|
+
"trial",
|
|
2641
|
+
"paying"
|
|
2642
|
+
]
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2645
|
+
},
|
|
2646
|
+
"customer_group.created": {
|
|
2647
|
+
"group": {
|
|
2648
|
+
"id": "grp_01H8X9YZ7E0J3K4M5N6T",
|
|
2649
|
+
"name": "Pro Plan",
|
|
2650
|
+
"color": "indigo",
|
|
2651
|
+
"member_count": 0
|
|
2652
|
+
}
|
|
2653
|
+
},
|
|
2654
|
+
"customer_group.deleted": {
|
|
2655
|
+
"customer_group": {
|
|
2656
|
+
"id": "grp_01H8X9YZ7E0J3K4M5N6T"
|
|
2657
|
+
}
|
|
2658
|
+
},
|
|
2659
|
+
"customer_group.updated": {
|
|
2660
|
+
"group": {
|
|
2661
|
+
"id": "grp_01H8X9YZ7E0J3K4M5N6T",
|
|
2662
|
+
"name": "Pro Plan (Annual)",
|
|
2663
|
+
"color": "indigo",
|
|
2664
|
+
"member_count": 38
|
|
2665
|
+
}
|
|
2666
|
+
},
|
|
2667
|
+
"player.achievement_unlocked": {
|
|
2668
|
+
"player": {
|
|
2669
|
+
"agent_id": "usr_01H8X9YZ7E0J3K4M5N6S",
|
|
2670
|
+
"name": "Riley"
|
|
2671
|
+
},
|
|
2672
|
+
"achievement": {
|
|
2673
|
+
"id": "first_resolve",
|
|
2674
|
+
"name": "First Resolve",
|
|
2675
|
+
"xp": 50
|
|
2676
|
+
}
|
|
2677
|
+
},
|
|
2678
|
+
"player.level_up": {
|
|
2679
|
+
"player": {
|
|
2680
|
+
"agent_id": "usr_01H8X9YZ7E0J3K4M5N6S",
|
|
2681
|
+
"name": "Riley"
|
|
2682
|
+
},
|
|
2683
|
+
"level": {
|
|
2684
|
+
"from": 7,
|
|
2685
|
+
"to": 8
|
|
2686
|
+
},
|
|
2687
|
+
"title_unlocked": "Apprentice Healer"
|
|
2688
|
+
},
|
|
2689
|
+
"player.quest_completed": {
|
|
2690
|
+
"player": {
|
|
2691
|
+
"agent_id": "usr_01H8X9YZ7E0J3K4M5N6S",
|
|
2692
|
+
"name": "Riley"
|
|
2693
|
+
},
|
|
2694
|
+
"quest": {
|
|
2695
|
+
"id": "resolve_5_tickets",
|
|
2696
|
+
"name": "Resolve 5 tickets today",
|
|
2697
|
+
"xp": 100
|
|
2698
|
+
}
|
|
2699
|
+
},
|
|
2700
|
+
"player.streak_milestone": {
|
|
2701
|
+
"player": {
|
|
2702
|
+
"agent_id": "usr_01H8X9YZ7E0J3K4M5N6S",
|
|
2703
|
+
"name": "Riley"
|
|
2704
|
+
},
|
|
2705
|
+
"streak_days": 5,
|
|
2706
|
+
"milestone": 5
|
|
2707
|
+
},
|
|
2708
|
+
"player.xp_gained": {
|
|
2709
|
+
"player": {
|
|
2710
|
+
"agent_id": "usr_01H8X9YZ7E0J3K4M5N6S",
|
|
2711
|
+
"name": "Riley"
|
|
2712
|
+
},
|
|
2713
|
+
"amount": 75,
|
|
2714
|
+
"reason": "ticket.resolved",
|
|
2715
|
+
"ticket_id": "tkt_01H8X9YZ7E0J3K4M5N6P"
|
|
2716
|
+
},
|
|
2717
|
+
"social.high_five_sent": {
|
|
2718
|
+
"from_team": {
|
|
2719
|
+
"id": "team_acme",
|
|
2720
|
+
"name": "Acme Support"
|
|
2721
|
+
},
|
|
2722
|
+
"to_team": {
|
|
2723
|
+
"id": "team_globex",
|
|
2724
|
+
"name": "Globex Support"
|
|
2725
|
+
},
|
|
2726
|
+
"message": "Thanks for the assist!"
|
|
2727
|
+
},
|
|
2728
|
+
"social.one_up_sent": {
|
|
2729
|
+
"from": {
|
|
2730
|
+
"agent_id": "usr_01H8X9YZ7E0J3K4M5N6S",
|
|
2731
|
+
"name": "Riley"
|
|
2732
|
+
},
|
|
2733
|
+
"to": {
|
|
2734
|
+
"agent_id": "usr_01H8X9YZ7E0J3K4M5N6V",
|
|
2735
|
+
"name": "Sam"
|
|
2736
|
+
},
|
|
2737
|
+
"ticket_id": "tkt_01H8X9YZ7E0J3K4M5N6P",
|
|
2738
|
+
"message": "Great empathy on this one"
|
|
2739
|
+
},
|
|
2740
|
+
"survey.submitted": {
|
|
2741
|
+
"survey": {
|
|
2742
|
+
"id": "svy_01H8X9YZ7E0J3K4M5N6Y",
|
|
2743
|
+
"ticket_id": "tkt_01H8X9YZ7E0J3K4M5N6P",
|
|
2744
|
+
"score": 5,
|
|
2745
|
+
"comment": "Resolved fast, thank you!",
|
|
2746
|
+
"submitted_at": "2026-04-27T19:30:00.000Z"
|
|
2747
|
+
},
|
|
2748
|
+
"customer": {
|
|
2749
|
+
"id": "cus_01H8X9YZ7E0J3K4M5N6Q",
|
|
2750
|
+
"email": "casey@example.com"
|
|
2751
|
+
}
|
|
2752
|
+
},
|
|
2753
|
+
"team.preferences_updated": {
|
|
2754
|
+
"team_id": "team_01H8X9YZ7E0J3K4M5N6U",
|
|
2755
|
+
"changed": [
|
|
2756
|
+
"bossBattlesEnabled"
|
|
2757
|
+
],
|
|
2758
|
+
"preferences": {
|
|
2759
|
+
"bossBattlesEnabled": false
|
|
2760
|
+
}
|
|
2761
|
+
},
|
|
2762
|
+
"ticket.assigned": {
|
|
2763
|
+
"ticket": {
|
|
2764
|
+
"id": "tkt_01H8X9YZ7E0J3K4M5N6P",
|
|
2765
|
+
"prefixed_id": "CST-1024"
|
|
2766
|
+
},
|
|
2767
|
+
"assignee": {
|
|
2768
|
+
"id": "usr_01H8X9YZ7E0J3K4M5N6S",
|
|
2769
|
+
"name": "Riley",
|
|
2770
|
+
"email": "riley@acme.test"
|
|
2771
|
+
},
|
|
2772
|
+
"previous_assignee": null
|
|
2773
|
+
},
|
|
2774
|
+
"ticket.closed": {
|
|
2775
|
+
"ticket": {
|
|
2776
|
+
"id": "tkt_01H8X9YZ7E0J3K4M5N6P",
|
|
2777
|
+
"prefixed_id": "CST-1024",
|
|
2778
|
+
"title": "Cannot reset password",
|
|
2779
|
+
"status": "resolved",
|
|
2780
|
+
"priority": "normal",
|
|
2781
|
+
"channel": "widget",
|
|
2782
|
+
"resolved_at": "2026-04-27T19:08:43.000Z"
|
|
2783
|
+
},
|
|
2784
|
+
"changes": {
|
|
2785
|
+
"status": {
|
|
2786
|
+
"from": "open",
|
|
2787
|
+
"to": "resolved"
|
|
2788
|
+
}
|
|
2789
|
+
}
|
|
2790
|
+
},
|
|
2791
|
+
"ticket.created": {
|
|
2792
|
+
"ticket": {
|
|
2793
|
+
"id": "tkt_01H8X9YZ7E0J3K4M5N6P",
|
|
2794
|
+
"prefixed_id": "CST-1024",
|
|
2795
|
+
"title": "Cannot reset password",
|
|
2796
|
+
"status": "new",
|
|
2797
|
+
"priority": "normal",
|
|
2798
|
+
"channel": "widget",
|
|
2799
|
+
"customer_id": "cus_01H8X9YZ7E0J3K4M5N6Q",
|
|
2800
|
+
"created_at": "2026-04-27T18:42:11.000Z"
|
|
2801
|
+
},
|
|
2802
|
+
"customer": {
|
|
2803
|
+
"id": "cus_01H8X9YZ7E0J3K4M5N6Q",
|
|
2804
|
+
"name": "Casey Patel",
|
|
2805
|
+
"email": "casey@example.com"
|
|
2806
|
+
}
|
|
2807
|
+
},
|
|
2808
|
+
"ticket.deleted": {
|
|
2809
|
+
"id": "CST-1024"
|
|
2810
|
+
},
|
|
2811
|
+
"ticket.message_added": {
|
|
2812
|
+
"ticket": {
|
|
2813
|
+
"id": "tkt_01H8X9YZ7E0J3K4M5N6P",
|
|
2814
|
+
"dashboard_url": "https://www.cstar.help/team/acme/tickets?selected=tkt_01H8X9YZ7E0J3K4M5N6P"
|
|
2815
|
+
},
|
|
2816
|
+
"message": {
|
|
2817
|
+
"id": "msg_01H8X9YZ7E0J3K4M5N6R",
|
|
2818
|
+
"sender": "agent",
|
|
2819
|
+
"sender_name": "Riley",
|
|
2820
|
+
"content": "I just sent a reset link to your inbox \u2014 let me know if it lands.",
|
|
2821
|
+
"created_at": "2026-04-27T18:55:02.000Z"
|
|
2822
|
+
},
|
|
2823
|
+
"customer": {
|
|
2824
|
+
"id": "cus_01H8X9YZ7E0J3K4M5N6Q",
|
|
2825
|
+
"name": "Casey Patel",
|
|
2826
|
+
"email": "casey@example.com"
|
|
2827
|
+
}
|
|
2828
|
+
},
|
|
2829
|
+
"ticket.updated": {
|
|
2830
|
+
"ticket": {
|
|
2831
|
+
"id": "tkt_01H8X9YZ7E0J3K4M5N6P",
|
|
2832
|
+
"prefixed_id": "CST-1024",
|
|
2833
|
+
"title": "Cannot reset password",
|
|
2834
|
+
"status": "open",
|
|
2835
|
+
"priority": "high",
|
|
2836
|
+
"channel": "widget"
|
|
2837
|
+
},
|
|
2838
|
+
"changes": {
|
|
2839
|
+
"priority": {
|
|
2840
|
+
"from": "normal",
|
|
2841
|
+
"to": "high"
|
|
2842
|
+
},
|
|
2843
|
+
"tags": {
|
|
2844
|
+
"from": [
|
|
2845
|
+
"bug"
|
|
2846
|
+
],
|
|
2847
|
+
"to": [
|
|
2848
|
+
"bug",
|
|
2849
|
+
"feature-request"
|
|
2850
|
+
]
|
|
2851
|
+
}
|
|
2852
|
+
}
|
|
2853
|
+
}
|
|
2854
|
+
};
|
|
2855
|
+
var WEBHOOK_EVENT_CATALOG = {
|
|
2856
|
+
"agent.preferences_updated": { label: "Agent Preferences Updated", description: "Fired when an agent's per-user UX preferences change (e.g., boringMode toggled)", category: "team" },
|
|
2857
|
+
"article.created": { label: "New Article Created", description: "Fired when a new Library article is created", category: "articles" },
|
|
2858
|
+
"article.deleted": { label: "Article Deleted", description: "Fired when an article is deleted via app or API", category: "articles" },
|
|
2859
|
+
"article.published": { label: "Article Published", description: "Fired when an article is published to the Public Library", category: "articles" },
|
|
2860
|
+
"article.updated": { label: "Article Updated", description: "Fired when an article content or metadata is modified", category: "articles" },
|
|
2861
|
+
"boss.damaged": { label: "Boss Damaged", description: "Fired when a boss takes damage from a ticket close", category: "gamification" },
|
|
2862
|
+
"boss.defeated": { label: "Boss Defeated", description: "Fired when a boss is defeated by the team", category: "gamification" },
|
|
2863
|
+
"boss.spawned": { label: "Boss Battle Started", description: "Fired when a boss appears for the team", category: "gamification" },
|
|
2864
|
+
"community_post.commented": { label: "New Comment on Post", description: "Fired when a new comment is added to a community post", category: "community" },
|
|
2865
|
+
"community_post.created": { label: "New Community Post", description: "Fired when a new community post is created", category: "community" },
|
|
2866
|
+
"community_post.deleted": { label: "Community Post Deleted", description: "Fired when a community post is deleted", category: "community" },
|
|
2867
|
+
"community_post.status_changed": { label: "Post Status Changed", description: "Fired when a community post status is changed (e.g., Planned, Completed)", category: "community" },
|
|
2868
|
+
"community_post.updated": { label: "Community Post Updated", description: "Fired when a community post is updated", category: "community" },
|
|
2869
|
+
"community_post.voted": { label: "Post Voted On", description: "Fired when a community post receives a vote", category: "community" },
|
|
2870
|
+
"customer.created": { label: "New Customer Added", description: "Fired when a new customer is created", category: "customers" },
|
|
2871
|
+
"customer.deleted": { label: "Customer Deleted", description: "Fired when a customer is deleted via app or API", category: "customers" },
|
|
2872
|
+
"customer.updated": { label: "Customer Updated", description: "Fired when customer details are modified", category: "customers" },
|
|
2873
|
+
"customer_group.created": { label: "New Customer Group", description: "Fired when a customer group is created", category: "customers" },
|
|
2874
|
+
"customer_group.deleted": { label: "Customer Group Deleted", description: "Fired when a customer group is deleted", category: "customers" },
|
|
2875
|
+
"customer_group.updated": { label: "Customer Group Updated", description: "Fired when a customer group is modified", category: "customers" },
|
|
2876
|
+
"player.achievement_unlocked": { label: "Achievement Unlocked", description: "Fired when a player unlocks an achievement", category: "gamification" },
|
|
2877
|
+
"player.level_up": { label: "Player Leveled Up", description: "Fired when a player reaches a new level", category: "gamification" },
|
|
2878
|
+
"player.quest_completed": { label: "Quest Completed", description: "Fired when a player completes a daily quest", category: "gamification" },
|
|
2879
|
+
"player.streak_milestone": { label: "Streak Milestone", description: "Fired when a player hits a streak milestone (3, 5, 10, or 25 days)", category: "gamification" },
|
|
2880
|
+
"player.xp_gained": { label: "XP Gained", description: "Fired when a player earns XP from closing a ticket or quest", category: "gamification" },
|
|
2881
|
+
"social.high_five_sent": { label: "High Five Sent", description: "Fired when a team sends a high five to another team", category: "gamification" },
|
|
2882
|
+
"social.one_up_sent": { label: "One-Up Sent", description: "Fired when a teammate sends a one-up recognition", category: "gamification" },
|
|
2883
|
+
"survey.submitted": { label: "Customer Feedback Received", description: "Fired when a customer submits a CSAT survey response", category: "csat" },
|
|
2884
|
+
"team.preferences_updated": { label: "Team Preferences Updated", description: "Fired when team-wide UX preferences change (e.g., bossBattlesEnabled toggled)", category: "team" },
|
|
2885
|
+
"ticket.assigned": { label: "Ticket Assigned", description: "Fired when a ticket is assigned to an agent", category: "tickets" },
|
|
2886
|
+
"ticket.closed": { label: "Ticket Closed/Resolved", description: "Fired when a ticket is resolved or closed", category: "tickets" },
|
|
2887
|
+
"ticket.created": { label: "New Ticket Created", description: "Fired when a new ticket is created via app, widget, API, or email", category: "tickets" },
|
|
2888
|
+
"ticket.deleted": { label: "Ticket Deleted", description: "Fired when a ticket is deleted via app or API", category: "tickets" },
|
|
2889
|
+
"ticket.message_added": { label: "New Message on Ticket", description: "Fired when a new message is added to a ticket", category: "tickets" },
|
|
2890
|
+
"ticket.updated": { label: "Ticket Updated", description: "Fired when a ticket status, priority, or assignment changes", category: "tickets" }
|
|
2891
|
+
};
|
|
2892
|
+
|
|
2425
2893
|
// src/index.ts
|
|
2426
2894
|
var CStarClient = class {
|
|
2427
2895
|
constructor(config) {
|
|
@@ -2438,6 +2906,7 @@ var CStarClient = class {
|
|
|
2438
2906
|
};
|
|
2439
2907
|
this.members = new MembersResource(this._httpClient);
|
|
2440
2908
|
this.settings = new SettingsResource(this._httpClient);
|
|
2909
|
+
this.preferences = new PreferencesResource(this._httpClient);
|
|
2441
2910
|
this.notifications = new NotificationsResource(this._httpClient);
|
|
2442
2911
|
this.mentions = new MentionsResource(this._httpClient);
|
|
2443
2912
|
this.attachments = new AttachmentsResource(this._httpClient);
|
|
@@ -2521,5 +2990,7 @@ var CStarClient = class {
|
|
|
2521
2990
|
CStarValidationError,
|
|
2522
2991
|
ErrorType,
|
|
2523
2992
|
OfflineQueue,
|
|
2524
|
-
Subscription
|
|
2993
|
+
Subscription,
|
|
2994
|
+
WEBHOOK_EVENT_CATALOG,
|
|
2995
|
+
WEBHOOK_EVENT_SAMPLES
|
|
2525
2996
|
});
|