@cstar.help/js 0.10.1 → 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.
- package/dist/chat/index.cjs +3 -1
- package/dist/chat/index.js +3 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/proactive/index.cjs +3 -3
- package/dist/proactive/index.js +3 -3
- package/package.json +1 -1
package/dist/chat/index.cjs
CHANGED
|
@@ -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
|
|
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: {
|
package/dist/chat/index.js
CHANGED
|
@@ -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
|
|
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/dist/proactive/index.cjs
CHANGED
|
@@ -288,7 +288,7 @@ var TriggerEngine = class {
|
|
|
288
288
|
}
|
|
289
289
|
/**
|
|
290
290
|
* Send analytics beacon (fire-and-forget).
|
|
291
|
-
*
|
|
291
|
+
* Must use application/json — SvelteKit CSRF rejects text/plain cross-origin.
|
|
292
292
|
* Falls back to fetch() if sendBeacon is unavailable or fails.
|
|
293
293
|
*/
|
|
294
294
|
sendEvent(eventType, signalType, metadata) {
|
|
@@ -300,14 +300,14 @@ var TriggerEngine = class {
|
|
|
300
300
|
metadata: metadata || {}
|
|
301
301
|
});
|
|
302
302
|
try {
|
|
303
|
-
const queued = navigator.sendBeacon?.(url, new Blob([payload], { type: "
|
|
303
|
+
const queued = navigator.sendBeacon?.(url, new Blob([payload], { type: "application/json" }));
|
|
304
304
|
if (!queued) throw void 0;
|
|
305
305
|
} catch {
|
|
306
306
|
try {
|
|
307
307
|
fetch(url, {
|
|
308
308
|
method: "POST",
|
|
309
309
|
body: payload,
|
|
310
|
-
headers: { "Content-Type": "
|
|
310
|
+
headers: { "Content-Type": "application/json" },
|
|
311
311
|
keepalive: true,
|
|
312
312
|
mode: "cors"
|
|
313
313
|
}).catch(() => {
|
package/dist/proactive/index.js
CHANGED
|
@@ -264,7 +264,7 @@ var TriggerEngine = class {
|
|
|
264
264
|
}
|
|
265
265
|
/**
|
|
266
266
|
* Send analytics beacon (fire-and-forget).
|
|
267
|
-
*
|
|
267
|
+
* Must use application/json — SvelteKit CSRF rejects text/plain cross-origin.
|
|
268
268
|
* Falls back to fetch() if sendBeacon is unavailable or fails.
|
|
269
269
|
*/
|
|
270
270
|
sendEvent(eventType, signalType, metadata) {
|
|
@@ -276,14 +276,14 @@ var TriggerEngine = class {
|
|
|
276
276
|
metadata: metadata || {}
|
|
277
277
|
});
|
|
278
278
|
try {
|
|
279
|
-
const queued = navigator.sendBeacon?.(url, new Blob([payload], { type: "
|
|
279
|
+
const queued = navigator.sendBeacon?.(url, new Blob([payload], { type: "application/json" }));
|
|
280
280
|
if (!queued) throw void 0;
|
|
281
281
|
} catch {
|
|
282
282
|
try {
|
|
283
283
|
fetch(url, {
|
|
284
284
|
method: "POST",
|
|
285
285
|
body: payload,
|
|
286
|
-
headers: { "Content-Type": "
|
|
286
|
+
headers: { "Content-Type": "application/json" },
|
|
287
287
|
keepalive: true,
|
|
288
288
|
mode: "cors"
|
|
289
289
|
}).catch(() => {
|