@cstar.help/js 0.10.2 → 0.10.3

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.
@@ -497,12 +497,13 @@ var ConversationsApi = class {
497
497
  /** List conversations for the identified customer. */
498
498
  async list(params) {
499
499
  const teamId = this.chat.getTeamId();
500
+ if (!teamId) throw new Error("Not identified. Call chat.identify() first.");
500
501
  const response = await this.chat.fetch(
501
502
  "/api/widget/conversations",
502
503
  {
503
504
  method: "GET",
504
505
  query: {
505
- teamId: teamId ?? void 0,
506
+ teamId,
506
507
  limit: params?.limit?.toString(),
507
508
  cursor: params?.cursor
508
509
  }
@@ -513,6 +514,7 @@ var ConversationsApi = class {
513
514
  /** Create a new conversation (ticket). */
514
515
  async create(params) {
515
516
  const teamId = this.chat.getTeamId();
517
+ if (!teamId) throw new Error("Not identified. Call chat.identify() first.");
516
518
  const response = await this.chat.fetch("/api/widget/tickets", {
517
519
  method: "POST",
518
520
  body: {
@@ -461,12 +461,13 @@ var ConversationsApi = class {
461
461
  /** List conversations for the identified customer. */
462
462
  async list(params) {
463
463
  const teamId = this.chat.getTeamId();
464
+ if (!teamId) throw new Error("Not identified. Call chat.identify() first.");
464
465
  const response = await this.chat.fetch(
465
466
  "/api/widget/conversations",
466
467
  {
467
468
  method: "GET",
468
469
  query: {
469
- teamId: teamId ?? void 0,
470
+ teamId,
470
471
  limit: params?.limit?.toString(),
471
472
  cursor: params?.cursor
472
473
  }
@@ -477,6 +478,7 @@ var ConversationsApi = class {
477
478
  /** Create a new conversation (ticket). */
478
479
  async create(params) {
479
480
  const teamId = this.chat.getTeamId();
481
+ if (!teamId) throw new Error("Not identified. Call chat.identify() first.");
480
482
  const response = await this.chat.fetch("/api/widget/tickets", {
481
483
  method: "POST",
482
484
  body: {
package/dist/index.cjs CHANGED
@@ -1354,10 +1354,10 @@ var CustomFieldsResource = class {
1354
1354
  async del(fieldId) {
1355
1355
  return this.client.request("DELETE", `/custom-fields/${fieldId}`);
1356
1356
  }
1357
- /** Reorder custom fields. */
1358
- async reorder(orderedIds) {
1357
+ /** Reorder custom fields within a content type. */
1358
+ async reorder(contentType, orderedIds) {
1359
1359
  return this.client.request("PUT", "/custom-fields/reorder", {
1360
- body: { orderedIds }
1360
+ body: { contentType, orderedIds }
1361
1361
  });
1362
1362
  }
1363
1363
  };
package/dist/index.d.cts CHANGED
@@ -1348,8 +1348,8 @@ declare class CustomFieldsResource {
1348
1348
  update(fieldId: string, params: CustomFieldUpdateParams): Promise<ApiResponse<CustomField>>;
1349
1349
  /** Delete a custom field. */
1350
1350
  del(fieldId: string): Promise<ApiResponse<DeleteResponse>>;
1351
- /** Reorder custom fields. */
1352
- reorder(orderedIds: string[]): Promise<ApiResponse<CustomField[]>>;
1351
+ /** Reorder custom fields within a content type. */
1352
+ reorder(contentType: 'ticket' | 'customer' | 'article', orderedIds: string[]): Promise<ApiResponse<CustomField[]>>;
1353
1353
  }
1354
1354
 
1355
1355
  /** An SLA rule. */
package/dist/index.d.ts CHANGED
@@ -1348,8 +1348,8 @@ declare class CustomFieldsResource {
1348
1348
  update(fieldId: string, params: CustomFieldUpdateParams): Promise<ApiResponse<CustomField>>;
1349
1349
  /** Delete a custom field. */
1350
1350
  del(fieldId: string): Promise<ApiResponse<DeleteResponse>>;
1351
- /** Reorder custom fields. */
1352
- reorder(orderedIds: string[]): Promise<ApiResponse<CustomField[]>>;
1351
+ /** Reorder custom fields within a content type. */
1352
+ reorder(contentType: 'ticket' | 'customer' | 'article', orderedIds: string[]): Promise<ApiResponse<CustomField[]>>;
1353
1353
  }
1354
1354
 
1355
1355
  /** An SLA rule. */
package/dist/index.js CHANGED
@@ -1316,10 +1316,10 @@ var CustomFieldsResource = class {
1316
1316
  async del(fieldId) {
1317
1317
  return this.client.request("DELETE", `/custom-fields/${fieldId}`);
1318
1318
  }
1319
- /** Reorder custom fields. */
1320
- async reorder(orderedIds) {
1319
+ /** Reorder custom fields within a content type. */
1320
+ async reorder(contentType, orderedIds) {
1321
1321
  return this.client.request("PUT", "/custom-fields/reorder", {
1322
- body: { orderedIds }
1322
+ body: { contentType, orderedIds }
1323
1323
  });
1324
1324
  }
1325
1325
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cstar.help/js",
3
- "version": "0.10.2",
3
+ "version": "0.10.3",
4
4
  "description": "Official TypeScript SDK for the cStar customer support platform",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",